I think that very(and I mean VERY) light flogging with a belt can be beneficial if one is strongly tempted to impurity, just to bring the body back to its senses. But serious flagellation and hairshirts are very, very serious, and can cause injury to health. So, at the very least, consult a good and holy priest before you consider doing this. I also like what was said above by the other posters. As Our Lady of Fatima said, the penance Our Lord seeks is that we do our daily duty.