Refactor TOTP into base HOTP