Perform dynamic truncation on HMAC result according to RFC 4226
HMAC result as byte array (minimum 20 bytes)
Number of digits in the final code (6 or 8)
Truncated code as string with leading zeros
(InternalError) - if HMAC array is too short or digits is invalid
Perform dynamic truncation on HMAC result according to RFC 4226