Medieval punishments were weird.
They are all over the place. I mean, in some instances you see heavy reliance on superstition (hello, trial by fire and trial by water). In others, you see gruesome acts of violence, such as people being publicly flogged or drawn and quartered. And, then, in other cases, you see Medieval justice using public pressure and shame to prevent future crime.
This is where the idea of being caught red-handed comes from.
In the 12th century, if someone was caught stealing, their hand was dipped in the juice from pressed berries. This red dye would stain the skin which would remain discolored for weeks.
This punishment served two purposes: First, the thief was publicly humiliated as he went about his day to day activities. He could not hide his criminal past from the rest of the world. Secondly, if the individual was not sincere in his desire for reformation, and he went to a different town to steal, his hand served as a warning to all those he came in contact with.