RFC 6238 TOTP worked by hand: one code, 18 test vectors, and the 32-byte key trap
A developer walks through computing a single TOTP code from the RFC 6238 test key at Unix time 59, showing each step from the time counter to the final eight digits. The article explains how TOTP differs from HOTP in its counter source and why the counter must always be encoded as an 8-byte big-endian value. It notes that the RFC's SHA-256 and SHA-512 test vectors require 32- and 64-byte keys, so using the 20-byte SHA-1 key silently produces wrong codes without raising an error. The piece also covers common user-entry problems with Base32 seeds and how clock offsets can be mistaken for key mismatches.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in