- What's the difference between TOTP and HOTP?
- TOTP (Time-based OTP) uses the current time to generate codes and typically changes automatically every 30 seconds. HOTP (Counter-based OTP) uses a counter that must be manually incremented each time you generate a code. TOTP is used by most 2FA apps, while HOTP is better suited for hardware tokens or offline scenarios.
- Where do I get the secret key?
- The secret key is typically provided by the service when you enable 2FA. It may be displayed as a QR code or as a Base32-encoded string. For development and testing purposes, you can generate a random Base32 string, but in production, you should use the secret key provided by the service.
- Which algorithm should I choose?
- SHA-1 is the most widely supported algorithm and is compatible with most 2FA systems. SHA-256 and SHA-512 provide stronger security but may not be supported by some older systems. It's recommended to start with SHA-1 unless you have specific requirements.
- Why doesn't the generated code match Google Authenticator?
- The most common reason is clock synchronization issues. TOTP relies on accurate time, so your device and server clocks must be synchronized. Also ensure that the secret key, algorithm (SHA-1), digits (6), and period (30 seconds) match exactly.
- Is this tool safe for production use?
- This tool is provided for educational and testing purposes. For production environments, use validated OTP libraries (e.g., speakeasy, otplib) and store secret keys securely (environment variables, secret management systems). Never expose secret keys in browser console or logs.