This should parameterize the hash algorithm.

HOTP only mentions SHA1 but TOTP which seems to be built directly on top of HOTP seems to make use of SHA1, SHA256, or SHA512.