I don’t think the church condones corporal punishment for acts of penance like the ones who may be referring too.
Historically, this was an accepted and common practice up until relatively recently. It was approved by the Church and a practice of many of the Saints of the past.
However, in the case of the OP of this thread, it sounds like someone who does not understand the function of the Sacrament of Confession. While performing the penance assigned by the priest is part of the Sacrament, there is no reason that this penance must be physical. We receive forgiveness through Sacraments, not through corporal punishment.
As others have already said, this sort of penance should only be done under the guidance of a spiritual director.