TOTP generator
Enter or generate a Base32 secret and get the current TOTP code per RFC 6238, the seconds left and the otpauth:// URI. Computed in your browser only.
As a rule, do not paste the secret of a real account into a website: whoever holds it can make your codes. This page does its work in your browser and sends the secret nowhere, but it is best used for testing and for secrets you are setting up yourself.
The setup key an app shows under “can’t scan the QR code”. Spaces and lowercase are fine.
Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the TOTP generator
- Paste a Base32 secret, or press Generate a secret for a new 160-bit one.
- Set the algorithm, digits and period to what the service uses. The defaults are the common ones.
- Read the current code and the seconds until it changes.
- Copy the otpauth:// URI if you need to turn the secret into a QR code for an app.
About this tool
The six-digit codes from an authenticator app are time-based one-time passwords, TOTP, defined in RFC 6238. The app and the server share a secret. Each takes the current time, divides it into 30-second steps, computes an HMAC of the step number with the secret, and cuts the result down to six digits. Same secret and same clock give the same code, with nothing sent between them.
This tool does that calculation so you can see it work: for testing a login you are building, checking that a server and an app agree, or generating a secret and the otpauth:// URI that a QR code carries. It supports SHA-1, SHA-256 and SHA-512, six or eight digits, and 30 or 60 seconds. Most apps and services use SHA-1, six digits and 30 seconds, and some apps ignore other settings.
The secret is the whole second factor. Anyone who has it can produce your codes forever, so as a rule do not paste the secret of a real account into any website. This page computes in your browser and sends the secret nowhere, but it is meant for development and for secrets you are creating. If codes do not match, the cause is nearly always a clock that is off or a mismatch in algorithm or digits.
Sources
Questions
Both sides hold the same secret key. Every 30 seconds they compute HMAC of the current time step with that key and reduce it to a short number. Because the time step changes, each code works only briefly, and because the key never travels, there is nothing to intercept at login except a code that soon expires.
Check the clock first: TOTP depends on the time, and a device that is a minute off gives different codes. Then check the settings. If the service uses SHA-256 or eight digits and the app assumed SHA-1 and six, the codes differ. Finally, make sure the whole secret was copied.
Yes. The known weakness of SHA-1 is collisions, which matter for signatures and certificates. TOTP uses SHA-1 inside HMAC, which does not depend on collision resistance, and HMAC-SHA-1 has no practical attack. SHA-1 remains the default mostly because every authenticator app supports it.
It is the text inside the QR code you scan when you set up two-factor authentication. It carries the secret, the account name, the issuer and optionally the algorithm, digits and period. Treat it like the secret itself: anyone who sees the URI or the QR code can generate the codes.
RFC 4226 requires at least 128 bits and recommends 160, which is 20 bytes or 32 Base32 characters. This tool generates 160-bit secrets. Shorter secrets, such as the 80-bit ones some services still issue, work but leave less margin.