Keep token and server counters distinct
01A token makes a new code after a button press. The server calculates its own expected value using its copy of the secret and counter.
The server advances beyond the accepted counter. This is the OTP validation outcome; other factors and application authorization remain separate.
Source for this drawing: RFC 4226 · Read RFC section 7.2 ↗
New to this? Start hereA quick picture + helpful background
A seal answers a specific question.
A certificate or signature supports particular checks about a key or message. It does not automatically prove that every claim or sender is trustworthy.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Terms in this drawing
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
Validation compares independently calculated values; it does not ask the token for the answer.
- HOTP means HMAC-Based One-Time Password. HMAC is a keyed message authentication code: a calculation that combines a secret key with input bytes. Here the changing input is an increasing counter, not a clock. The token and validation server share a unique secret K for that token (§§4–5.2).
- The moving factor C is an eight-byte counter that MUST be synchronized. A new code request increments the token counter before calculating the next value (§7.2, verified editorial erratum 5723). The server increments only after successful authentication (§7.4).
- Explicit example convention: the token last generated counter 0; the server next expects counter 1. A press advances the token to 1 and displays287082 from Appendix D. The server computes HOTP(K,1) itself and compares the received digits. Verified technical erratum 4994 corrects §7.2 to say calculated by the server.
- On success at counter 1, the server next expects2; the token last generated remains1 until another request. The same consumed counter is no longer eligible. Six-digit outputs can collide at different counters: this is counter consumption, not a promise that the displayed number can never recur.
- Counters and codes are examples, not enrollment defaults. The public ASCII secret in Appendix D is test data and MUST NOT be used as a real secret. Protocol P MUST support two-factor authentication; possession of a code alone is not the whole login (§7.1).
Offline public test values and selected rules; not a login service, secure token implementation or deployment recommendation.
Read the RFC section ↗