flagellant

nouns

a person who is whipped or whips himself for sexual gratification
is derived from
is a type of (narrower)
someone who obtains pleasure from receiving punishment
a person who whips himself as a religious penance
is derived from
is a type of (narrower)
(Roman Catholic Church) a person who repents for wrongdoing (a Roman Catholic may be admitted to penance under the direction of a confessor)