Building OTP Authentication from Scratch: Unraveling HOTP and TOTP
2025-04-15

This post dives deep into the inner workings of One-Time Password (OTP) algorithms, HOTP and TOTP. Starting with the author's experience implementing authentication at work, it explains the security benefits of OTPs and details the HMAC-based OTP generation process, including key hashing, timestamp calculations, and final code generation. A demo app built by the author is also provided for readers to learn and test.
Development