implement hardening in BCD2 algorithm