Hash/Crittografia
TOTP Generator/Verifier
Password monouso basate sul tempo (TOTP, RFC 6238) — genera il codice attuale da un segreto e verifica un codice inserito con tolleranza allo sfasamento dell'orologio.
------
TOTP (Time-based One-Time Password, RFC 6238) is a two-factor authentication algorithm that generates a one-time code from a secret and the current time. It's exactly what runs under the hood in Google Authenticator, Authy, and similar apps.
How to use it
- Generate: paste a secret key (usually Base32, the same one encoded in a 2FA setup QR code) and the tool shows the current 6-digit code along with the time left before it changes.
- Verify: enter a secret and a code from an authenticator app to check whether they match.
- Verification tolerates a small amount of clock drift — it accepts a code from a neighboring time step, not just the current one.
Common uses
- Debugging your own 2FA implementation on the backend — checking that the server generates and accepts codes correctly.
- Manually generating a code for an account when you don't have your phone with the authenticator app handy.
- Figuring out why an app's code is being rejected by the server (usually the cause is a clock out of sync).
Things to keep in mind
A TOTP code is only valid for a short window (usually 30 seconds) — that time limit is the main protection, not the secret alone.
Code accuracy depends directly on the device's clock being synced; a noticeable clock drift is the most common cause of rejected 2FA codes.
Articolo su questo strumento: TOTP: come funzionano i codici monouso nelle app di autenticazione
Domande frequenti
Perché il mio codice generato scade così velocemente?
I codici TOTP sono basati sul tempo — per impostazione predefinita ruotano ogni 30 secondi, calcolati dall'orario Unix corrente e dal segreto condiviso. Questa breve finestra limita per quanto tempo un codice trapelato rimane utile.
Cosa succede se l'orologio del mio dispositivo non è sincronizzato?
TOTP si basa sul fatto che entrambe le parti concordino approssimativamente sull'ora corrente. La maggior parte delle app di autenticazione e dei server consente una piccola tolleranza di sfasamento dell'orologio (tipicamente un intervallo di tempo), ma uno sfasamento maggiore causerà il rifiuto di codici validi.
La mia chiave segreta viene inviata da qualche parte quando genero un codice qui?
No. Il codice TOTP viene calcolato interamente nel tuo browser — la chiave segreta non lascia mai il tuo dispositivo.
TOTP protegge dal phishing?
Non completamente. Se la vittima inserisce la password e il codice TOTP corrente su un sito falso, l'attaccante può usare istantaneamente entrambi i valori sul sito vero, mentre il codice è ancora valido. Da questo attacco in tempo reale proteggono solo le chiavi hardware secondo lo standard FIDO2/WebAuthn.
Perché il server accetta anche l'intervallo di tempo precedente e non solo quello attuale?
Questo compensa un piccolo ritardo di rete tra la generazione del codice sul telefono e il momento in cui il server lo riceve e lo verifica. Senza questa tolleranza, i codici legittimi verrebbero talvolta rifiutati per un normale ritardo di pochi secondi.