Select four bytes and reduce to digits
03Dynamic truncation uses the low four bits of the last HMAC byte to choose four consecutive bytes.
The result is displayed in six decimal positions. Leading zeroes are retained; truncation is not encryption or six selected digest characters.
Source for this drawing: RFC 4226 · Read RFC section 5.3 ↗
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.
Use a byte offset, clear the top bit, then take the decimal remainder.
- HS is exactly 20 bytes for base HOTP. Its byte 19 supplies the low-order four bits as an offset in 0…15. Copy the four consecutive bytes starting at that byte offset; mask their most significant bit to obtain an unsigned31-bit integer (§5.3).
- The official §5.4 example digest is1f8698690e02ca16618550ef7f19da8e945b555a. Its last byte5a has low nibblea, decimal 10. Select bytes=10…13:50 ef 7f 19. Clearing the high bit leaves50ef7f19, decimal1357872921.
- With Digit=6, reduce1357872921 modulo1000000 to get 872921. Display exactly six digits, preserving leading zeroes; illustrative remainder42 is000042 (Appendix C). This §5.4 example is separate from the Appendix D key/counter vectors.
- Implementations MUST extract at least six digits; considering seven or more is a SHOULD (§5.3). This guide illustrates six, and the bounded helper supports six through eight as explicitly discussed there. It does not impose the proposed nine-digit MUST NOT from Held for Document Update erratum 5792 as an accepted new requirement.
- Reported errata 6756 and7651 discuss alternate digest lengths and bit/byte notation. They are not verified corrections. This guide uses the unambiguous20-byte SHA-1 example in §5.4 and byte indexes. Reported erratum 5129 proposes fixed-offset Appendix D results; retain the published dynamic-offset values.
Offline public test values and selected rules; not a login service, secure token implementation or deployment recommendation.
Read the RFC section ↗