How TOTP (Time-Based One-Time Password) Works in Practice
When you scan a 2FA QR code into an authenticator app (such as Aegis, Ente Auth, 2FAS, or Bitwarden), your device stores a Base32-encoded secret seed. Every 30 seconds, both your phone and the server divide the current Unix time by 30 and compute an HMAC-SHA1 digest over that counter, truncating the result into a 6-digit numeric code without requiring internet connectivity.
Defensive Mitigation & Hardening Checklist
Use TOTP authenticator apps instead of SMS 2FA to eliminate SIM-swapping risk, and remember that TOTP codes can still be relayed by real-time Adversary-in-the-Middle (AitM) phishing sites—verify the domain URL or upgrade to passkeys where supported.