Hashes/Cripto
TOTP Generator/Verifier
Contraseñas de un solo uso basadas en tiempo (TOTP, RFC 6238) — genera el código actual a partir de un secreto y verifica un código introducido con tolerancia al desfase horario.
------
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.
Preguntas frecuentes
¿Por qué mi código generado caduca tan rápido?
Los códigos TOTP están basados en el tiempo — por defecto rotan cada 30 segundos, calculándose a partir del tiempo Unix actual y el secreto compartido. Esta ventana corta limita cuánto tiempo sigue siendo útil un código filtrado.
¿Qué pasa si el reloj de mi dispositivo está desincronizado?
TOTP depende de que ambas partes coincidan de cerca en la hora actual. La mayoría de las apps de autenticación y servidores permiten una pequeña tolerancia de desfase (normalmente un paso de tiempo), pero una desviación mayor hará que se rechacen códigos válidos.
¿Se envía mi clave secreta a algún sitio al generar un código aquí?
No. El código TOTP se calcula enteramente en tu navegador — la clave secreta nunca sale de tu dispositivo.
¿TOTP protege contra el phishing?
No del todo. Si la víctima introduce la contraseña y el código TOTP vigente en un sitio falso, el atacante puede usar ambos valores de inmediato en el sitio real mientras el código sigue siendo válido. Contra este ataque en tiempo real solo protegen las llaves físicas basadas en el estándar FIDO2/WebAuthn.
¿Por qué el servidor acepta también el intervalo de tiempo anterior y no solo el actual?
Esto compensa una pequeña latencia de red entre la generación del código en el teléfono y el momento en que el servidor lo recibe y verifica. Sin ese margen, códigos legítimos a veces se rechazarían por un simple retraso de unos segundos.