Psychology Today - Why Punishing Yourself Doesn’t Mean You’re Crazy

When the Black Plague spread across Europe in the 13th and 14th centuries people publically whipped themselves with irons in bloody processions of self-flagellation because they believed it would cleanse their souls and ward off the deadly disease.

As civilization advanced, so have our methods of self-punishment, as evidenced by the lack of people who whip themselves into a bloody mess in public and the abundance of people who bang their heads into a wall in private. Indeed, the practice of self-punishment is far more common than we realize

http://www.psychologytoday.com/blog/the-squeaky-wheel/201407/why-punishing-yourself-doesn-t-mean-you-re-crazy