Two-factor authentication in plain PHP, no library
TOTP is HMAC-SHA1 over a time counter, truncated to six digits. About forty lines, and it works with every authenticator app.
3 entries
TOTP is HMAC-SHA1 over a time counter, truncated to six digits. About forty lines, and it works with every authenticator app.
One token per session, compared in constant time, checked on every state-changing POST. Twenty lines and no dependency.
Five flags and one call to regenerate. Defaults leave the session cookie readable by scripts and sendable over plain HTTP.