해시/암호화
TOTP Generator/Verifier
시간 기반 일회용 비밀번호(TOTP, RFC 6238) — 시크릿으로 현재 코드를 생성하고, 시계 오차를 허용하며 입력된 코드를 검증합니다.
------
TOTP (Time-based One-Time Password, RFC 6238) is a two-factor authentication algorithm that generates a one-time code from a secret and the current time. It's exactly what runs under the hood in Google Authenticator, Authy, and similar apps.
How to use it
- Generate: paste a secret key (usually Base32, the same one encoded in a 2FA setup QR code) and the tool shows the current 6-digit code along with the time left before it changes.
- Verify: enter a secret and a code from an authenticator app to check whether they match.
- Verification tolerates a small amount of clock drift — it accepts a code from a neighboring time step, not just the current one.
Common uses
- Debugging your own 2FA implementation on the backend — checking that the server generates and accepts codes correctly.
- Manually generating a code for an account when you don't have your phone with the authenticator app handy.
- Figuring out why an app's code is being rejected by the server (usually the cause is a clock out of sync).
Things to keep in mind
A TOTP code is only valid for a short window (usually 30 seconds) — that time limit is the main protection, not the secret alone.
Code accuracy depends directly on the device's clock being synced; a noticeable clock drift is the most common cause of rejected 2FA codes.
자주 묻는 질문
생성된 코드가 왜 이렇게 빨리 만료되나요?
TOTP 코드는 시간 기반입니다 — 기본적으로 현재 유닉스 시간과 공유 비밀로 계산되어 30초마다 갱신됩니다. 이 짧은 창은 유출된 코드가 유용하게 남아 있는 시간을 제한합니다.
기기의 시계가 동기화되지 않으면 어떻게 되나요?
TOTP는 양쪽이 현재 시간에 대체로 동의한다는 것에 의존합니다. 대부분의 인증 앱과 서버는 약간의 시계 오차(보통 한 타임 스텝)를 허용하지만, 더 큰 오차는 유효한 코드가 거부되게 만듭니다.
여기서 코드를 생성할 때 제 비밀 키가 어딘가로 전송되나요?
아니요. TOTP 코드는 브라우저 내에서 완전히 계산됩니다 — 비밀 키는 기기를 벗어나지 않습니다.
TOTP는 피싱을 막아주나요?
완전히는 아닙니다. 피해자가 가짜 사이트에 비밀번호와 현재 TOTP 코드를 입력하면, 공격자는 코드가 유효한 동안 두 값을 즉시 실제 사이트에 사용할 수 있습니다. 이런 실시간 공격을 막는 것은 FIDO2/WebAuthn 표준의 하드웨어 키뿐입니다.
서버가 현재 시간 구간뿐 아니라 이전 구간도 받아주는 이유는 무엇인가요?
휴대폰에서 코드가 생성되는 시점과 서버가 이를 받아 확인하는 시점 사이의 약간의 네트워크 지연을 보완하기 위해서입니다. 이런 여유가 없다면 몇 초의 일반적인 지연만으로도 정상적인 코드가 거부될 수 있습니다.