-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase32-encoder-decoder.html
More file actions
298 lines (262 loc) · 14.9 KB
/
Copy pathbase32-encoder-decoder.html
File metadata and controls
298 lines (262 loc) · 14.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!DOCTYPE html>
<html lang="en">
<head>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1981515451878575" crossorigin="anonymous"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Base32 Encoder & Decoder Online (RFC 4648) | QuickDevBox</title>
<meta name="description" content="Encode and decode Base32 strings instantly compliant with RFC 4648. Free client-side Base32 tool running securely offline in your browser.">
<link rel="canonical" href="https://quickdevbox.com/base32-encoder-decoder">
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css?v=2.2">
<!-- Complete OpenGraph & Social Preview Tags -->
<meta property="og:title" content="Base32 Encoder & Decoder Online (RFC 4648) | QuickDevBox">
<meta property="og:description" content="Encode and decode Base32 strings instantly compliant with RFC 4648. Free client-side Base32 tool running securely offline in your browser.">
<meta property="og:url" content="https://quickdevbox.com/base32-encoder-decoder">
<meta property="og:type" content="website">
<meta property="og:image" content="https://quickdevbox.com/og-image.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Base32 Encoder & Decoder Online (RFC 4648) | QuickDevBox">
<meta name="twitter:description" content="Encode and decode Base32 strings instantly compliant with RFC 4648. Free client-side Base32 tool running securely offline in your browser.">
<meta name="twitter:image" content="https://quickdevbox.com/og-image.png">
<!-- Search Robots Directive -->
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Base32 Encoder & Decoder Online",
"description": "Encode and decode Base32 strings instantly compliant with RFC 4648. Free client-side Base32 tool running securely offline in your browser.",
"url": "https://quickdevbox.com/base32-encoder-decoder",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "All",
"browserRequirements": "Requires JavaScript. Requires HTML5.",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"author": {
"@type": "Organization",
"name": "QuickDevBox Tools",
"url": "https://quickdevbox.com"
}
}
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-E0LZHPD7SL"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-E0LZHPD7SL');
</script>
</head>
<body>
<header>
<div class="nav-container">
<a href="/" class="logo">
<img src="favicon.svg" alt="QuickDevBox Logo">
QuickDevBox<span>.com</span>
</a>
<nav class="nav-links">
<a href="/">Home</a>
<a href="/json-formatter">JSON Tools</a>
<a href="/cron-expression-generator">Cron Generator</a>
<a href="/jwt-decoder">JWT Decoder</a>
<a href="/base64-encoder-decoder">Base64</a>
<a href="mailto:support@quickdevbox.com?subject=QuickDevBox%20Feedback" class="nav-support">✉️ Support</a>
</nav>
</div>
</header>
<main>
<section class="hero" style="padding: 0.5rem 0 0.8rem;">
<h1 style="font-size: 1.6rem; margin-bottom: 0.3rem;">Base32 Encoder & Decoder</h1>
<p style="font-size: 0.88rem;">Encode and decode text into RFC 4648 compliant Base32 representations for 2FA TOTP keys.</p>
</section>
<section class="tool-box">
<div class="privacy-banner">
<span>🛡️ <strong>100% Client-Side Processing:</strong> Secrets and strings are encoded locally without network requests.</span>
</div>
<div class="tool-controls">
<button class="btn btn-secondary" onclick="document.querySelectorAll('textarea, input[type=text], input[type=number]').forEach(el => el.value=''); if(typeof updateCounter==='function')updateCounter();" style="color:var(--danger); font-size:0.8rem; padding:0.4rem 0.8rem; margin-left:0.5rem;">🗑️ Clear</button>
<button data-ux="action-primary" class="btn" onclick="encodeBase32()">🔒 Encode Base32</button>
<button class="btn btn-secondary" onclick="decodeBase32()">🔓 Decode Base32</button>
<button class="btn btn-sample" onclick="loadSample()">💡 Fill Sample</button>
<button class="btn btn-secondary" onclick="copyResult()">📋 Copy Output</button>
</div>
<!-- AdSense Responsive Slot -->
<div class="ad-slot-header"></div>
<div class="editor-wrapper">
<div>
<div class="editor-header"><span class="editor-counter" id="editor-counter" style="float:right; font-size:0.8rem; margin-right:10px;">0 chars | 0 lines</span><span style="font-size:0.75rem; color:var(--text-muted); float:right; margin-top:4px;">(Ctrl+Enter)</span> Input Text / Base32 Secret</div>
<textarea data-ux="input" id="b32Input" rows="12" placeholder="Enter text to encode or Base32 string to decode... e.g. JBSWY3DPEHPK3PXP"></textarea>
</div>
<div>
<div class="editor-header"><span class="editor-counter" id="editor-counter-2" style="float:right; font-size:0.8rem; margin-right:10px;">0 chars | 0 lines</span><span style="font-size:0.75rem; color:var(--text-muted); float:right; margin-top:4px;">(Ctrl+Enter)</span> Output Result</div>
<textarea id="b32Output" rows="12" readonly placeholder="Result will appear here..."></textarea>
</div>
</div>
<div id="statusMsg" class="status-msg"></div>
</section>
<article class="seo-article">
<h2>Base32 Encoding: RFC 4648 5-bit Grouping, TOTP Keys & Crockford Standards</h2>
<p>Base32 encodes binary payloads into a 32-character case-insensitive ASCII alphabet using 5-bit grouping (2^5 = 32). It eliminates visually ambiguous characters (like 0, 1, 8, 9) and serves as the universal encoding standard for TOTP two-factor authentication secrets.</p>
<div class="security-advisory">
<h4>🔒 Cryptographic Security & Memory Defense Advisory</h4>
<p>Client-side cryptographic operations require defensive programming to protect sensitive keys and data from runtime introspection:</p>
<ul>
<li><strong>CSPRNG Nonce Generation:</strong> Always use <code>window.crypto.getRandomValues()</code> for IVs, salts, and nonces. Never use pseudo-random generators like <code>Math.random()</code> for key derivation or stream initialization.</li>
<li><strong>Timing Attack Mitigation:</strong> Evaluate authentication digests and HMAC tags using constant-time comparison (e.g. <code>crypto.timingSafeEqual</code>) to prevent microsecond side-channel timing leaks.</li>
<li><strong>Key Hygiene & GC Deallocation:</strong> Overwrite sensitive plaintext buffers and key material in memory immediately after cipher execution to minimize memory dump exposure windows.</li>
</ul>
</div>
<h3>Cryptographic Parameter Matrix & Specifications</h3>
<table>
<thead>
<tr><th>Cryptographic Attribute</th><th>Standard Requirement / Security Bound</th></tr>
</thead>
<tbody>
<tr><td><strong>IETF Standard</strong></td><td>RFC 4648 §6 (The Base32 Alphabet: A-Z and 2-7)</td></tr>
<tr><td><strong>Bit Slicing</strong></td><td>5 input bytes (40 bits) map into 8 output characters (5 bits each)</td></tr>
<tr><td><strong>2FA Security Primitive</strong></td><td>Standard secret format for Google Authenticator & RFC 6238 TOTP</td></tr>
<tr><td><strong>Padding Character</strong></td><td>Equals sign (=) for byte lengths not divisible by 5</td></tr>
</tbody>
</table>
<h3>Audited Cryptographic Implementation Code</h3>
<h4>JavaScript Base32 Encoder</h4>
<pre><code>function base32Encode(buffer) {
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
let bits = 0, value = 0, output = '';
for (let i = 0; i < buffer.length; i++) {
value = (value << 8) | buffer[i];
bits += 8;
while (bits >= 5) {
output += alphabet[(value >>> (bits - 5)) & 31];
bits -= 5;
}
}
if (bits > 0) output += alphabet[(value << (5 - bits)) & 31];
while (output.length % 8 !== 0) output += '=';
return output;
}</code></pre>
<h4>Python 3 (base64 module)</h4>
<pre><code>import base64
secret = b"TOTP_SECRET_KEY_123"
encoded = base64.b32encode(secret).decode('ascii')
decoded = base64.b32decode(encoded).decode('utf-8')
print("Base32 Key:", encoded)</code></pre>
<h3>Zero-Knowledge Architecture & Key Lifecycle Governance</h3>
<p>All cryptographic operations execute exclusively within your client browser memory using the native Web Cryptography API (W3C WebCrypto). Unencrypted plaintext payloads, private key pairs, and secret parameters are never transmitted across the network, stored in cookies, or written to disk. When implementing cryptographic modules in backend environments, enforce strict secret isolation, rotate master encryption keys using hardware-backed KMS solutions, and zero out plaintext byte buffers immediately following block cipher operations. Adhere to FIPS 140-3 guidelines for validated cryptographic boundary controls and secure entropy source verification.</p>
<h3>Official Security Standards & RFC References</h3>
<ul>
<li><a href="https://datatracker.ietf.org/doc/html/rfc4648#section-6" target="_blank" rel="noopener noreferrer">IETF RFC 4648 §6: Base32 Data Encoding</a></li>
<li><a href="https://datatracker.ietf.org/doc/html/rfc6238" target="_blank" rel="noopener noreferrer">IETF RFC 6238: TOTP: Time-Based One-Time Password Algorithm</a></li>
</ul>
</article>
<section class="related-tools">
<h3>Explore Related Developer Utilities</h3>
<div class="related-links">
<a href="/base64-encoder-decoder">🔑 Base64 Encoder</a>
<a href="/jwt-decoder">🛡️ JWT Decoder</a>
<a href="/hash-generator">⚡ SHA-256 Hash</a>
<a href="/timestamp-converter">⏳ Unix Timestamp</a>
<a href="/bcrypt-hash-generator">🔒 Bcrypt Generator</a>
</div>
</section>
</main>
<footer>
<div class="footer-container" style="max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--bg-card-border);">
<p>© 2026 QuickDevBox.com — Free, Open Source & Privacy-First Developer Tools</p>
<p style="margin-top: 0.5rem;">
<a href="/privacy-policy" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">Privacy Policy</a> |
<a href="/terms" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">Terms of Service</a> |
<a href="/about" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">About</a> |
<a href="https://github.com/hbx1982/quickdevbox" target="_blank" rel="noopener noreferrer" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">GitHub</a> |
<a href="mailto:support@quickdevbox.com?subject=QuickDevBox%20Feedback" style="color: var(--text-muted); text-decoration: none; margin: 0 0.5rem;">Contact Support</a>
</p>
</div>
</footer>
<script>
function showStatus(msg, isError = false) {
const el = document.getElementById('statusMsg');
el.style.display = 'block';
el.className = 'status-msg ' + (isError ? 'status-error' : 'status-success');
el.innerText = msg;
}
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
function loadSample() {
document.getElementById('b32Input').value = "JBSWY3DPEHPK3PXP";
decodeBase32();
}
function encodeBase32() {
const input = document.getElementById('b32Input').value;
if (!input) return;
let bin = "";
for (let i = 0; i < input.length; i++) {
bin += input.charCodeAt(i).toString(2).padStart(8, '0');
}
let res = "";
for (let i = 0; i < bin.length; i += 5) {
let chunk = bin.substring(i, i + 5);
if (chunk.length < 5) chunk = chunk.padEnd(5, '0');
res += alphabet[parseInt(chunk, 2)];
}
document.getElementById('b32Output').value = res;
showStatus("Text encoded to Base32 successfully!");
}
function decodeBase32() {
const input = document.getElementById('b32Input').value.trim().toUpperCase().replace(/=/g, '');
if (!input) return;
try {
let bin = "";
for (let i = 0; i < input.length; i++) {
const idx = alphabet.indexOf(input[i]);
if (idx === -1) throw new Error("Invalid character");
bin += idx.toString(2).padStart(5, '0');
}
let res = "";
for (let i = 0; i + 8 <= bin.length; i += 8) {
res += String.fromCharCode(parseInt(bin.substring(i, i + 8), 2));
}
document.getElementById('b32Output').value = res;
showStatus("Base32 decoded successfully!");
} catch (err) {
showStatus("Invalid Base32 sequence.", true);
}
}
function copyResult() {
const out = document.getElementById('b32Output').value;
if (!out) return;
navigator.clipboard.writeText(out);
showStatus("Result copied to clipboard!");
}
// Keyboard Shortcuts Support
document.addEventListener('keydown', function(e) {
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
e.preventDefault();
const primaryBtn = document.querySelector('[data-ux="action-primary"], .btn-primary, button[onclick^="process"], button[onclick^="generate"], button[onclick^="analyze"]');
if (primaryBtn) primaryBtn.click();
}
});
// Large File Safeguard
document.querySelectorAll('textarea').forEach(ta => {
ta.addEventListener('input', function(e) {
if (e.target.value.length > 2 * 1024 * 1024) {
if (typeof showStatus === 'function') {
showStatus("Input exceeds 2MB limit. To protect your browser from freezing, please use a smaller payload.", true);
} else {
alert("Input exceeds 2MB limit!");
}
e.target.value = e.target.value.substring(0, 2 * 1024 * 1024);
if (typeof updateCounter === 'function') updateCounter();
}
});
});
</script>
<script src="ux-enhancements.js?v=2.2"></script>
</body>
</html>