2ClickKit

In-Browser TOTP Two-Factor Authenticator

Files Never Leave Your Device

Offline RFC 6238 Time-based One-Time Password generator powered by Web Crypto API with live animated 30-second countdown wheel and zero server uploads.

In-Browser TOTP Two-Factor Authenticator

RFC 6238 Time-based One-Time Password generator running 100% offline via client-side Web Crypto.

100% In-Browser · Private & Secure
LIVE PASSCODESHA-1 · 30s Step
------
30s
Previous (-1):------
Next (+1):------

The Cryptographic Foundations of Two-Factor Authentication (RFC 6238)

Static passwords represent the single greatest vulnerability in modern information security. Credential stuffing, database breaches, keyloggers, and social engineering attacks compromise billions of user passwords annually. To enforce defense-in-depth, security architectures mandate Multi-Factor Authentication (MFA), combining something you know (a password) with something you have (a cryptographic token or authenticator device).

Standardized in May 2011 by the Internet Engineering Task Force (IETF), RFC 6238: TOTP: Time-Based One-Time Password Algorithm extended the event-based HMAC algorithm (RFC 4226 HOTP) into a synchronized, time-driven verification protocol. Today, TOTP is the global standard powering Google Authenticator, Microsoft Authenticator, 1Password, Bitwarden, YubiKey, and enterprise identity providers worldwide.

The Mathematical Pipeline: How TOTP Derives a 6-Digit Passcode

The elegance of TOTP lies in its simplicity: it requires zero network communication between the authenticator app and the login server. Both parties execute an identical mathematical derivation:

Derivation Stage Mathematical Formula Description
1. Time-Step Counter T = floor((Current_Unix_Time - T0) / X) Divides current Unix seconds by the period window X (typically 30 seconds), where T0 = 0 (Unix epoch Jan 1 1970).
2. HMAC Computation HS = HMAC-SHA1(K, T) Computes a 20-byte (160-bit) HMAC hash using the shared secret key K and the 8-byte big-endian representation of counter T.
3. Dynamic Truncation Offset = HS[19] & 0x0F Extracts the low-order 4 bits of the last byte of the HMAC to determine an offset index between 0 and 15.
4. 31-Bit Binary Extraction P = (HS[Offset] & 0x7F) << 24 | ... Extracts a 4-byte dynamic binary code starting at the offset, masking out the sign bit to avoid signed integer ambiguities.
5. Modulo Reduction Passcode = P MOD 10^Digits Reduces the 31-bit integer modulo 1,000,000 (for 6 digits) or modulo 100,000,000 (for 8 digits), padded with leading zeroes.

Demystifying Base32 Encoding (RFC 3548 / RFC 4648)

When setting up 2FA, websites present secret keys as 16 or 32 character strings like JBSWY3DPEHPK3PXP. Why is Base32 used instead of Base64 or Hexadecimal?

Human Ergonomics of Base32

Base32 utilizes an uppercase 32-character alphabet consisting of A–Z and digits 2–7. It deliberately excludes the numbers 0, 1, and 8, and letters O and I. This eliminates common human transcription confusion between the number zero (0) and uppercase O, or between the digit one (1), lowercase l, and uppercase I when users manually type setup codes.

Clock Drift and Verification Windows

Because TOTP uses the device's local system clock, physical quartz crystal oscillators in computers and phones can drift by several seconds over time. RFC 6238 §6 addresses clock drift through tolerance windows:

  • Default Validation Horizon: The server computes the code for T = current, as well as T - 1 (the preceding 30-second window) and T + 1 (the next 30-second window).
  • Replay Attack Prevention: Once a server accepts a passcode from time step T, it must record that the code has been consumed and immediately reject any subsequent login attempts using the exact same code within that window.

Native Web Crypto API: True Client-Side Cryptographic Security

Unlike unsafe web tools that send secret keys to backend servers to compute passcodes via PHP or Node.js scripts, 2ClickKit leverages the W3C Web Crypto API (window.crypto.subtle) directly within your browser:

// Native browser cryptographic execution (Zero server roundtrips)
const key = await window.crypto.subtle.importKey(
  'raw',
  secretBytes,
  { name: 'HMAC', hash: { name: 'SHA-1' } },
  false,
  ['sign']
);

const signature = await window.crypto.subtle.sign('HMAC', key, counterBuffer);
// Passcode truncated and formatted in client-side RAM

Because the computation executes entirely in client-side JavaScript, you can disconnect your computer from the internet, disable Wi-Fi, and generate valid TOTP authentication passcodes completely offline.

Production Best Practices for 2FA Management

  • Always Secure Backup Codes: When enabling TOTP on any service, immediately store the one-time backup recovery codes in an encrypted password vault. If your authenticator device is lost or destroyed, backup codes are the only recovery mechanism.
  • Never Share Raw Base32 Secrets: Anyone who obtains your Base32 secret key can generate identical valid passcodes at any time without your knowledge.
  • Synchronize Clocks with NTP: If your TOTP passcodes are repeatedly rejected by servers, verify that your computer operating system clock is synchronized with a Network Time Protocol (NTP) server (such as time.google.com or time.windows.com).

How to Use In-Browser TOTP Two-Factor Authenticator

  1. Enter or Paste Base32 Secret Key

    Input your 2FA secret key (e.g. JBSWY3DPEHPK3PXP) or paste a complete otpauth:// URI exported from your password manager.

  2. Select Digit Length & Interval

    Choose standard 6-digit or 8-digit output, and configure 30-second or 60-second time-step windows.

  3. Choose HMAC Hash Algorithm

    Select standard HMAC-SHA1 (default for Google Authenticator) or modern HMAC-SHA256 / HMAC-SHA512 algorithms.

  4. Observe Live Animated Countdown

    Watch the SVG circular timer wheel count down from 30 seconds, automatically computing next and previous drift codes.

  5. Copy 6-Digit Passcode

    One-click copy the active one-time password to complete your two-factor login authentication flow.

Google Authenticator Passcode Generation

Secret Key (Base32)
JBSWY3DPEHPK3PXP
Live Generated 6-Digit Code
123 456 (30-second animated circular timer)

Computed offline via native Web Crypto API with zero server data transfer.

Technical Specifications

  • Supported Inputs: RFC 6238 Time-Based OTP (TOTP), RFC 4226 Event-Based OTP (HOTP), RFC 4648 Base32 Secret Keys, Standard otpauth:// URI Schemes
  • Input Limit: Unlimited (100% in-browser offline)
  • Processing Engine: 100% In-Browser (W3C Web Crypto API HMAC-SHA1)
  • Content Uploads: None (Your files and text are processed locally on your device with zero uploads)

Privacy & Security Guarantee

Your Base32 secret keys and time-synchronized passcodes are processed entirely in your web browser's memory using native client-side web technologies. Unlike traditional cloud tools, your content is never uploaded to remote servers, stored on external disks, or analyzed by third parties.

2ClickKit In-Browser vs Traditional Cloud Tools

Feature 2ClickKit (In-Browser) Traditional Cloud Services
Data Privacy Files never leave your local device Uploaded to remote servers and third-party clouds
Processing Speed Instant local execution (0ms upload time) Constrained by internet upload & server processing queues
Account & Costs 100% Free with zero registration or paywalls Tiered subscriptions, limits, or forced sign-ups

Frequently Asked Questions

How does the TOTP algorithm (RFC 6238) calculate passcodes without an internet connection?

Time-based One-Time Passwords (TOTP) do not require an active internet connection. The algorithm computes a counter based on the current Unix epoch time divided by a fixed time step (typically 30 seconds): Counter = floor(Unix_Time / 30). Because both your device and the authenticating server share the same Base32 secret key and synchronized clocks, both sides independently compute identical HMAC hashes and derive the exact same 6-digit passcode.

Is it safe to generate TOTP two-factor codes in a web browser?

Yes, provided the tool executes 100% client-side. 2ClickKit uses the native W3C Web Crypto API (window.crypto.subtle) to perform HMAC-SHA1 signatures entirely inside your local CPU and RAM. Your secret key is never sent across the internet, logged in cookies, or transmitted to any remote server. It functions with complete security even when your computer is disconnected from Wi-Fi.

What is an otpauth:// URI and how does it work?

An otpauth:// URI is a standardized URI scheme established by Google Authenticator to encode TOTP parameters into QR codes. A typical URI looks like: 'otpauth://totp/Example:[email protected]?secret=JBSWY3DPEHPK3PXP&issuer=Example&algorithm=SHA1&digits=6&period=30'. Our tool automatically extracts the Base32 secret, digits, and period when an otpauth string is pasted.

What does the 'Previous (-1)' and 'Next (+1)' drift window mean?

Because computer and smartphone clocks can experience slight clock skew (typically a few seconds ahead or behind true atomic time), authentication servers implement an acceptance window (RFC 6238 §6). Servers typically accept passcodes from the current time step as well as the immediate previous (-1) and next (+1) windows to prevent lockouts due to minor timing drifts.

Why do most services use HMAC-SHA1 instead of SHA-256 for TOTP?

When RFC 6238 was drafted, RFC 4226 (HOTP) mandated HMAC-SHA1. Early mobile authenticator apps (such as the original Google Authenticator) only supported SHA-1. While the TOTP standard supports SHA-256 and SHA-512, SHA-1 remains universally supported across 99% of enterprise identity providers (Okta, GitHub, AWS, Google) for legacy interoperability.

Can an attacker compromise my 2FA if they capture one single 6-digit passcode?

No. The 6-digit passcode is mathematically derived from a one-way cryptographic HMAC hash. It is computationally impossible to reverse a 6-digit passcode back into the underlying Base32 secret key. Furthermore, the passcode expires after 30 seconds and is discarded by the server after single use.