HOTP

HOTP (HMAC-based One-Time Password, RFC 4226) è la variante basata su contatore di TOTP. Dove TOTP avanza su un orologio, HOTP avanza su un contatore condiviso che sia il token che il server incrementano a ogni codice usato. HOTP è il modo canonico per YubiKey OATH, token hardware legacy e alcuni flussi bancari dove il server non può fare affidamento sulla sincronizzazione dell'orologio.

Canonical spec:RFC 4226, HOTP: An HMAC-Based One-Time Password Algorithm (2005).
URI scheme:Google Authenticator Key URI Format, the otpauth:// scheme every authenticator agrees on.
Sibling spec:TOTP (RFC 6238), time-based variant that builds on HOTP.

Cos'è

An HOTP enrolment QR is a URL in the otpauth:// scheme with hotp as the type. It carries the shared HMAC secret plus a counter value that both sides must keep in sync. Format:

otpauth://hotp/LABEL?secret=SECRET&issuer=ISSUER&counter=N&digits=N&algorithm=ALG

HOTP vs TOTP, quando usare quale

ProprietàHOTP (RFC 4226)TOTP (RFC 6238)
Avanza suContatoreOrologio (ogni 30 s)
Richiede sync orologioNoSì, entro ~30 s di deriva
Risincronizzazione alla derivaIl server accetta i successivi N valori del contatoreIl server accetta ±1 finestra
Deployment tipicoYubiKey, token hardware legacy, banking offlineOgni 2FA consumer, Google, Microsoft, 1Password, Authy
Riutilizzo del contatoreCatastrofico, perde il segreto nel tempoN/A
Vulnerabilità se il segreto trapelaTutti i codici futuri prevedibiliTutti i codici passati + futuri prevedibili

Vettori di test canonici

RFC 4226 Appendix D provides reference HOTP values for the secret 12345678901234567890 (20 bytes, Base32 GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ) with 6-digit output:

CounterHOTP (6-digit)
0755224
1287082
2359152
3969429
4338314
5254676
6287922
7162583
8399871
9520489

Minimal QR payload for enrolment at counter 0:

otpauth://hotp/Example:test?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Example&counter=0

Validatore di segreto Base32 live

Same validator as the TOTP page, HOTP secrets use the identical Base32 alphabet (RFC 4648 §6: A-Z, 2-7). Runs in your browser, no server round-trip.

Inserisci un segreto da validare.

Insidie comuni

Compatibilità delle app di autenticazione

App / tokenHOTPSHA256/5128 cifreNote
YubiKey Authenticator (iOS/Android/desktop)HOTP è il modo canonico di YubiKey OATH. Supporto RFC 4226 completo.
Google AuthenticatorIgnorato (solo SHA1)Ignorato (solo 6)La baseline de facto. Sicuro per HOTP ma solo con 6 cifre SHA1.
1PasswordSupporto RFC completo. Il contatore è memorizzato ed esportato con la voce.
BitwardenSupporto RFC completo.
Microsoft AuthenticatorSupporto RFC completo.
AuthyNo,,HOTP rimosso nelle versioni recenti. Solo TOTP.
Duo MobileNo,,Usa il proprio flusso push; solo TOTP come fallback.
Token hardware OATH (Feitian, Token2, ecc.)VariaVariaMercato canonico hardware HOTP; sempre 6 cifre SHA1 salvo indicazione contraria nel datasheet.

Vedi anche

Spec references verified Riferimenti alle specifiche verificati il