Security · Authentication

TOTP: verifying a code nobody stored

Press Learn from the beginning to walk through it step by step, or Play to just watch a new code appear every window. Hover any box for a one-line reminder.

Time window T
0
Seconds left
30s
Current code
------
Verified
0
Shared secret · Kfrom QR codefixed, ~20 bytes
Time counter · Tfloor(now / 30)new value every 30s
HMAC-SHA1 ( K , T )20-byte digest
Dynamic truncationpick 4 bytesoffset from last byte
mod 1 000 000------6 digits
Serverrecompute & comparestores only K
1 / 8

secret KJBSWY3DPEHPK3PXP… (fixed, scanned from the QR code)
now → T1717000530 ÷ 30 = 57233351 ← this is T
HMAC-SHA1(K,T)1f8698690e02ca16618550ef7f19da8e945b555a (20 bytes)
truncatelast byte 5a → offset 10 → bytes 50 ef 7f 19 = 1357872921
mod 1 000 0001357872921 mod 1000000 = 872921 ← the code you type
speed

Space plays or pauses · next lesson