Cybersecurity glossary
What is Hash-Based One-Time Password (HOTP)?
Learn what HOTP is, how counter-based one-time passwords work, how HOTP differs from TOTP, security limitations versus FIDO, and practical guidance for deploying HOTP authenticators.
Definition
Hash-Based One-Time Password (HOTP) is an algorithm that generates one-time numeric codes from a shared secret and an incrementing counter using an HMAC-based computation, defined in RFC 4226 and widely used in hardware tokens and some authenticator apps.
Why counter-based OTPs exist
Before time-synced authenticator apps dominated, many organizations issued button-press tokens. HOTP standardized how those devices and servers derive a one-time code from a shared secret and a counter using HMAC.
It remains important to understand because legacy estates still depend on it—and because its limitations explain why FIDO became the preferred upgrade path.
How HOTP generates a code
Share a secret
Token and server provision the same secret key K out of band.
Maintain a counter
Both sides track counter C; the token increments when a code is produced.
Compute HMAC
HOTP value is derived from HMAC-SHA-1 (classically) over the counter.
Truncate to digits
Dynamic truncation produces a 6–8 digit code the user types.
Server verifies and advances
On success, the server advances its counter; look-ahead windows handle desync.
HOTP vs TOTP at a glance
| Aspect | HOTP | TOTP |
|---|---|---|
| Moving factor | Incrementing counter | Time step |
| User experience | Button/press generates next code | Code refreshes automatically |
| Desync risk | Counter drift from unused generations | Clock skew between device and server |
| Phishing resistance | Low | Low |
| Typical modern use | Legacy hardware tokens | Authenticator apps |
Security strengths and limits
Strength: one-time codes
A captured code should not work indefinitely after the counter advances.
Strength: offline tokens
Hardware tokens can operate without network connectivity on the device.
Limit: shared secret
Seed database breaches clone every token derived from those secrets.
Limit: phishing/relay
Real-time attackers can prompt users for the current HOTP value.
Limit: resync windows
Large look-ahead windows improve UX but expand acceptable counter space.
Limit: weak transport
Typing codes into forms inherits all browser phishing problems.
Operational checklist
- Protect HOTP seed provisioning; treat seed records as credential material.
- Rate-limit verification attempts and alert on spraying across many accounts.
- Keep resync windows as small as operations allow.
- Invalidate or rotate tokens after suspected seed exposure.
- Prefer FIDO2/WebAuthn for new high-assurance MFA programs.
- If OTP remains required, document whether HOTP or TOTP is in use and why.
- Ensure recovery codes and help-desk resets are audited.
- Do not confuse multi-protocol hardware keys in OTP mode with phishing-resistant FIDO mode.
The practical takeaway
HOTP is the counter-based OTP algorithm behind many classic hardware tokens. It improves on static passwords but still relies on a shared secret and user-typed codes that phishing can intercept.
Understand HOTP to support legacy systems—and plan migrations toward origin-bound authenticators whenever risk demands phishing resistance.
Related security terms
Time-Based One-Time Password (TOTP)
Time-window OTP algorithm derived from the HOTP construction.
One-Time Password (OTP)
Broader category of single-use authentication codes.
Multi-Factor Authentication (MFA)
MFA deployments that may still rely on HOTP tokens.
FIDO2
Phishing-resistant alternative to OTP-based MFA.
Hardware Security Key
Devices that may expose HOTP and/or FIDO2 modes.
Frequently asked questions
What is HOTP in simple terms?
HOTP creates a one-time login code from a shared secret and a counter that advances each time you generate or use a code—common in older hardware tokens.
How does HOTP differ from TOTP?
HOTP uses a counter; TOTP uses time steps. TOTP codes change automatically every 30 seconds or so, while HOTP codes change when the counter increments.
Which RFC defines HOTP?
RFC 4226 defines HOTP: An HMAC-Based One-Time Password Algorithm.
Why can HOTP tokens get out of sync?
If a user generates codes without submitting them, the token counter can move ahead of the server. Servers usually allow a look-ahead window to resynchronize.
Is HOTP phishing-resistant?
No. Users can be tricked into entering a valid HOTP code on a fake site, and attackers can replay it quickly against the real service.
When is HOTP still used?
Legacy hardware tokens, some smart-card ecosystems, and environments that standardized on counter-based OTP before TOTP and FIDO became common.
What should new deployments prefer?
Prefer FIDO2/passkeys for phishing resistance. If OTP is required, TOTP is often easier operationally than HOTP, with rate limits and monitoring.
References
Explore authoritative guidance and frameworks related to hash-based one-time password (hotp).
Explore every security definition
Return to the glossary to search by term, alias, starting letter, or security category.