The Google Authenticator computation in Elixir

The Google Authenticator computation in Elixir

A from-scratch walk through Google Authenticator's TOTP scheme in Elixir: decode the Base32 80-bit secret, turn Unix time into a 30-second counter, and take the HMAC-SHA1 of it. Pattern matching pulls the last 4 bits of the 20-byte hash as an offset, selects four bytes, drops the top bit, and the remaining 31-bit value becomes the six-digit code. Bitstrings and Erlang's built-in crypto make this a tidy fit for Elixir.

⌘K

Start typing to search...

Search across content, newsletters, and subscribers