Back to Updates
DevTool Team

Peel Encodings to the Bottom, Pick the Right Hash: Using a Browser Cryptography Workbench Correctly

Holding a string that might be Base64, Hex, or URL-encoded, and one layer down it's still garbage? This guide starts with identification cues (alphabet, length, prefix, separators), then the workbench pipeline — chain decode steps into a flow and inspect every intermediate result. Then it separates the three cryptographic primitives by the problem each solves: hashes for integrity, HMAC for authentication, AES for confidentiality — plus the three commonest misuses (Base64 as encryption, MD5 for passwords, hashing as encryption). Ending with honesty: the workbench offers only SHA-256/512 and omits MD5 and SHA-1 on purpose, warns below 100,000 PBKDF2 iterations, uses a tool-specific agcm1 envelope for AES-GCM, and is for analysis and debugging — production keys don't belong in any web page.

Identify first: what is this string

The workbench's first job is answering "what is this". Four cues in priority order (using this site's Encoding and Cryptography Workbench as the example — its auto-detection suggests operations from exactly these cues):

Cue Shape Most likely
Alphabet Only 0-9 a-f, even length Hex
Alphabet A-Z a-z 0-9 + /, 0-2 trailing = Base64
Alphabet Same but - _ for + /, no = Base64URL
Symbols Lots of %XX URL encoding
Symbols & < ' HTML entities
Structure Two . splitting three segments, each Base64URL-like JWT
Prefix Starts with agcm1: This workbench's AES-GCM envelope

Identify, peel one layer, inspect: output that still looks like another encoding means keep peeling (Base64-over-Hex nesting and URL-encoding-over-Base64 are both common); JSON or readable text means bottom.

The pipeline: turning peeling into a reproducible flow

What separates a workbench from a single-purpose encoder is the flow: chain multiple steps in order and run them at once, with intermediate results, errors, and warnings at every step. Typical flows:

URL decode → Base64URL decode → JWT decode          (unpack a token carried in a URL parameter)
Hex decode → Base64 decode → readable text            (double-encoded log payloads)
PBKDF2 derive → AES-GCM decrypt → Base64 decode       (open an encrypted envelope)

The flow's value: intermediate results are visible — when step two fails you know whether step one peeled wrong or the input itself is bad; flows serialize into share links, so a colleague reproduces the exact result instead of following a verbal "first this, then that". Configuration (salt, IV, iterations, output length) lives inside the flow, and random salt/IV generate in one click.

Three primitives: one problem each

The cryptographic operations in a workbench aren't "the more advanced the better" — they're three tools for three questions:

The question you're answering Use Characteristics Typical scenario
Did the content change? Hash (SHA-256 / SHA-512) One-way, keyless, anyone can compute Checksums, dedup, content addressing
Did a key holder send it, intact? HMAC-SHA256 Hash + key API signatures, webhook verification
Can others see it? AES-GCM Reversible, keyed, integrity-tagged Confidential transport, encrypted storage
Key from a passphrase PBKDF2-SHA256 Slow by design (brute-force resistance) Passphrase → AES key

The three commonest misuses: Base64 as encryption (it's an encoding — one-step reversible, keyless), MD5/SHA for password storage (an unsalted fast hash falls to a rainbow table), hashing as encryption (hashes are one-way; "decrypting SHA-256" isn't a thing). The workbench's design guards against these: no MD5, and insufficient PBKDF2 iterations trigger a warning.

Honest limits of the workbench

  • Only SHA-256/512, no MD5 or SHA-1 — deliberate: both have practical collision attacks; non-adversarial checksums are fully served by SHA-256;
  • PBKDF2 below 100,000 iterations warns, but for storing user passwords prefer Argon2id / bcrypt — PBKDF2 is "acceptable under compliance or compatibility constraints", not the first choice;
  • The AES-GCM agcm1 envelope is this tool's own format (prefix + salt + IV + ciphertext packed together), not an interoperability standard — don't expect another system to open it directly; repackage per the other side's format for cross-system use;
  • In-browser processing with keys never uploaded is true (Web Crypto API runs locally), but the workbench is an analysis and debugging tool: unpack a token, verify a signature, try a flow — it doesn't manage key lifecycles, doesn't defend against side channels, and isn't a key management system. Production keys and real passphrases don't belong in any web page, this one included.

Frequently Asked Questions

I have a string of unknown encoding — how do I tell which decoder to use?

Four cues. Alphabet: only 0-9 a-f with even length is almost certainly Hex; A-Z a-z 0-9 plus + / with trailing = is Base64; - _ instead and no = is Base64URL; lots of %XX is URL encoding; & and < are HTML entities. Structure: three dot-separated Base64URL-like segments is nearly always a JWT. Peel one layer and look: output resembling another encoding means keep peeling; JSON or readable text means bottom. A workbench with auto-detection suggests candidates from exactly these cues.

What's the difference between hashing, HMAC, and encryption, and when do I use each?

Three different questions. A hash answers "did the content change" — one-way, keyless — for checksums and dedup. HMAC answers "did a key holder send this, intact" — hash plus key — for API signatures and webhook verification. Encryption (AES-GCM) answers "can others see the content" — reversible, keyed — for confidential transport and storage. The commonest misuse is treating them as substitutes: hashes can't be decrypted, Base64 isn't encryption, HMAC provides no confidentiality.

Why does the tool offer only SHA-256/512 and not MD5 or SHA-1?

Deliberately omitted. Both have practical collision attacks and shouldn't appear in any security context; their one remaining acceptable use — non-adversarial checksums — is fully served by SHA-256. Leaving weak algorithms out keeps users from unknowingly carrying them into a security context. To confirm someone's MD5 checksum, one line of md5sum does it.

How many PBKDF2 iterations should I set, and why does the tool warn?

Iteration count is PBKDF2's only lever against brute force. The workbench warns below 100,000, the safety floor; OWASP's current guidance for PBKDF2-HMAC-SHA256 is 600,000. The more important truth: for storing user passwords, prefer Argon2id or bcrypt — memory-hard functions resist GPU cracking better; PBKDF2 is acceptable under compliance or compatibility constraints, not the first choice.