admin@likeapro.dev: ~/totp — zsh

// admin tools · 06

TOTP tester

Live 6- or 8-digit codes from any base32 secret or otpauth:// URI, with countdown, ±N window verification and a fresh-secret enrolment QR — RFC 6238 / 4226, computed with WebCrypto.

// runs locally — secrets never leave this tab

mode
digits

current code

------

previous

—

next

—

Codes are computed with crypto.subtle HMAC from the secret above and this device's clock. If they don't match your app, check the device time first.

LIVE local only · 0 bytes sent --:--:--

How it works

What it does

This tester computes the one-time codes an authenticator app would show for a given secret, so you can debug a 2FA integration without reaching for your phone. Paste a base32 secret or a full otpauth:// URI and you get the current code, a countdown to the next one, and the previous and next codes either side. The --new tab mints a fresh 160-bit secret with an enrolment QR code; --verify checks a code the way a server would, across a tolerance window.

Everything runs locally in your browser with crypto.subtle. Secrets are never stored, never put in the URL and are wiped when you leave the page.

How the code is calculated

HOTP (RFC 4226) takes an HMAC of an 8-byte big-endian counter using the shared secret as the key, then applies dynamic truncation: the low four bits of the last byte pick an offset, four bytes are read from there, the top bit is masked off and the result is reduced modulo 10digits. TOTP (RFC 6238) is HOTP where the counter is the time step T = floor(unix_time / period), usually 30 seconds.

secret
Raw key bytes, written in base32 (A–Z, 2–7). Spaces, lowercase and missing = padding are accepted.
algorithm
HMAC-SHA1 by default. SHA256 and SHA512 are in the RFC, but several popular apps quietly ignore the parameter and use SHA1.
digits
6 is standard, 8 is common for banking and VPN tokens.
period
Seconds per step. Anything other than 30 is poorly supported by consumer apps.

On load the page runs the RFC 6238 Appendix B test vectors for all three hash functions and tells you if this browser gets a different answer.

The otpauth:// URI

Enrolment QR codes contain a Key URI such as otpauth://totp/Issuer:account?secret=…&issuer=Issuer&algorithm=SHA1&digits=6&period=30. The tester parses the label and parameters, warns when the issuer in the label disagrees with the issuer= parameter, and flags settings that apps commonly ignore.

FAQ

Why don't my codes match the app?

In order of likelihood: the device clock is wrong (TOTP depends on both clocks agreeing to within a step), the algorithm or digit count differs, or the secret was copied with a typo. The --verify tab reports which step a code matched, which shows clock drift directly.

How wide should the verification window be?

RFC 6238 recommends allowing at most one step of network delay, so ±1 step (a 90-second span) is the usual setting. A wider window makes brute force easier. Servers should also refuse a code that has already been used.

Is it safe to paste a real secret here?

The page makes no network requests with it, but treat any production secret with care: anyone holding it can generate valid codes. Prefer test accounts when debugging.

What does HOTP resync mean?

HOTP counters drift when a user presses the button without logging in. Servers look ahead a few counters, and when a code matches they store the matched counter plus one.