Developer Tools

Hash Functions in the Browser: How to Use CapyToolkit's Client-Side Hash Generator for Integrity Checks and HMAC Signatures

12 min read
Client-Side Hashing for Integrity Checks

Downloading a new CLI tool from a GitHub release page usually triggers a familiar verification routine: copying the project’s published SHA-256 checksum and pasting it into an online hashing utility to confirm your binary arrived intact. Unfortunately, this convenient workflow often forces you to upload your files to third-party servers, exposing your data to silent logging and caching risks before you even run the software. Fortunately, you can eliminate this exposure entirely. This guide covers what hash functions actually do, which algorithms are still safe in 2026, how HMAC signatures protect API requests and webhooks, and how to run every bit of this locally: no uploads, no server, no exposed data.

What Hashing Actually Does

A hash function takes any input, a single character, a 2 GB file, a JSON payload, and produces a fixed-length fingerprint called a digest.1 The process is deterministic: the same input always yields the same output. Change one bit in the input, though, and the resulting digest looks completely different. This is the avalanche effect, and it’s what makes hashes useful for detecting tampering.

Three properties matter most:

  • Deterministic: the same input always produces the same digest, every time, on every machine.
  • One-way: you cannot reconstruct the original data from the digest, no matter how much computing power you throw at it.
  • Collision-resistant: finding two different inputs that produce the same digest should be computationally infeasible.

The output length is also fixed regardless of input size. SHA-256 always gives you 256 bits, whether the input is an empty string or a full disk image.1

Unlike reversible encoding schemes like Base64 or key-dependent encryption algorithms designed to lock data away, a hash function serves strictly as a digital fingerprint: a one-way, tamper-evident signature that cannot be unraveled. This distinction matters because fingerprints let two parties independently confirm that they hold the same data without transmitting the data itself. Both sides hash their copy, compare the digests, and know immediately whether the files match.

CapyToolkit’s free browser-based hash generator that computes SHA-256 and HMAC digests entirely in your browser without uploading files, which uses your browser’s Web Crypto API for modern algorithms like SHA-256 and HMAC, operates fully offline after the initial page load.1 By running this built-in cryptographic engine in the browser tab, the tool keeps your data on your machine while you hash or sign it.

Algorithm Comparison: When to Use MD5, SHA-1, SHA-256, or SHA-512

To help you navigate this cryptographic landscape, the table below stacks up the digest sizes, vulnerability statuses, and standard industry use cases for the four primary hashing algorithms:

AlgorithmDigest SizeSecurity StatusCommon Use Cases
MD5128-bit (32 hex chars)2Broken: collision attacks practical since 2004Legacy checksums, hash tables, non-security fingerprinting
SHA-1160-bit (40 hex chars)1Deprecated: practical collision demonstrated 2017Legacy systems, Git object IDs (transitioning), old certificates
SHA-256256-bit (64 hex chars)1Secure: NIST recommends SHA-2 or SHA-3 as alternatives to SHA-1TLS, package managers, API signing, general purpose
SHA-512512-bit (128 hex chars)1Secure: same SHA-2 family as SHA-256Systems requiring longer digest

MD5 and SHA-1: Legacy Only

MD5 produces a 128-bit digest, typically rendered as 32 hexadecimal characters.2 Researchers demonstrated practical collision attacks against MD5 in 2004, and generating two distinct files with the same MD5 hash can now be done quickly with commodity tools.3 SHA-1, at 160 bits,1 held up longer but fell in 2017 when Google and CWI Amsterdam published the SHAttered attack, producing two different PDFs with an identical SHA-1 digest.4 NIST deprecated SHA-1 for most uses in 2011.4

Verifying a legacy checksum still has practical value. Older software releases, legacy file transfer systems, and long-lived documentation often publish MD5 or SHA-1 hashes. You need to verify those values when you encounter them. Just don’t choose either algorithm for anything new.

SHA-256: The Default

SHA-256 produces a 256-bit digest and belongs to the SHA-2 family standardized by NIST.1 NIST currently recommends SHA-2 or SHA-3 as alternatives to SHA-1.4 It’s the algorithm behind TLS certificate fingerprints, Git commit integrity (with an ongoing migration plan), npm and pip package checksums, and Bitcoin proof-of-work.

For new integrations, SHA-256 is the right default for both plain hashing and HMAC. If a system you’re building needs a hash function and nobody has specified an algorithm, SHA-256 is the safe call.

SHA-512: When Longer Matters

SHA-512 is also from the SHA-2 family and produces a 512-bit digest.1 The longer output is useful when a system explicitly requires it; for ordinary integrity checks, SHA-256 is usually easier to copy and compare.

Use SHA-512 when a specific system requires it. Otherwise, SHA-256’s 64-character hex output is easier to copy, paste, and compare. For a complete end-to-end file verification workflow using SHA-256 or SHA-512, the file integrity checker that computes and compares local checksums in your browser without any upload walks through the verification step by step.

HMAC Signatures for API and Webhook Security

While standard hash functions excel at verifying static file integrity, they fall short when you must authenticate the origin of a transmission. Consequently, establishing trust across APIs and webhooks requires a keyed hashing mechanism to prove both sender identity and data integrity simultaneously. If a webhook payload arrives at your server, how do you know it actually came from the sender and wasn’t injected by an attacker? A plain SHA-256 hash of the payload doesn’t answer that question.

HMAC solves this by mixing a secret key into the hash computation, as defined in the HMAC specification that describes how a secret key is mixed into the hash in two nested passes. NIST describes HMAC as a message authentication mechanism that uses cryptographic hash functions with a shared secret key.5 If your server and the webhook sender share a secret, and the HMAC digests match, you know both that the payload is authentic and that it hasn’t been modified in transit. SHA-256 is the recommended algorithm for new HMAC integrations. Use MD5 or SHA-1 HMAC only when the sending service mandates it and you have no choice.

How HMAC Works

To achieve this, the HMAC construction first pads the secret key to match the underlying hash block size. It then runs two nested hashing passes, mixing the padded key with an inner padding constant (ipad) before appending the message, and wrapping that result with an outer padding constant (opad), producing a keyed signature that only someone with the secret can reproduce.5

You don’t need to memorize the formula. Just understand that the secret key is baked into both rounds of hashing, which means an attacker who doesn’t know the key cannot forge a valid digest, even if they know the message content.

Technical diagram of HMAC construction showing a secret key padded to block size, XORed with inner padding and hashed with the message, then XORed with outer padding and hashed again to produce the final digest
HMAC's two-pass design prevents length-extension attacks on standard hash functions. An attacker who knows the message cannot forge the digest without also knowing the secret key.

Common HMAC Workflows

HMAC signatures show up in several common integration patterns:

  • Webhook signing: the sender computes HMAC-SHA256(payload, shared_secret), sends the digest in a header, and the receiver recomputes to verify. GitHub documents this HMAC-SHA256 pattern in the X-Hub-Signature-256 header, and Stripe requires webhook signature verification with the Stripe-Signature header.67
  • API request signing: the client signs a canonical string built from the method, path, timestamp, and body. The server validates before processing, which prevents both tampering and replay attacks.
  • Message queue authentication: producers sign messages with a shared key, and consumers verify before acting on them. This stops injected messages from being processed as legitimate.

The webhook signature verifier that validates HMAC-SHA256 digests against Stripe, GitHub, and Shopify header formats in the browser walks through each platform’s specific header format and implementation details. For inspecting how HMAC-based signing relates to token formats, CapyToolkit’s JWT Decoder & Claims Inspector lets you inspect JWT headers and payloads, many of which use HMAC signatures internally.

Hex vs Base64 Output Formats

Same underlying bytes, different representation. Neither format is more or less secure than the other. It’s purely about what the system you’re working with expects.

Hexadecimal encoding uses two characters per byte (0-9, a-f). A SHA-256 digest encodes as 64 hex characters. This is the default format in most development tools, package managers, and TLS certificates. When someone publishes a checksum, they almost always publish it in hex.

Base64 encoding packs three bytes into four characters. A SHA-256 digest encodes as 44 Base64 characters, including its padding character.8 You’ll see Base64 in HTTP headers, JWT signatures, and any MIME-derived contexts where compactness matters.

CapyToolkit’s hash generator lets you toggle between hex and Base64 without re-hashing. The tool re-encodes the already-computed digest client-side. No second round of computation, no network request. The rule is simple: match whatever format the system on the other end expects.

Verifying File Integrity End-to-End

The most common real-world scenario: you’ve downloaded a software package, and the release page publishes a checksum. Here’s the workflow using CapyToolkit’s tools:

  1. Copy the published checksum from the download page (usually SHA-256, sometimes SHA-512).
  2. For string-based checksums, like a hash of a license key or config value, use the browser-based hash generator that computes SHA-256, SHA-512, and HMAC digests locally without uploading: paste the string into the input box, verify the SHA-256 output matches the published value.
  3. For file-based verification, use the File Hash Verifier: drop the downloaded file into the browser, select the matching algorithm, compare the computed digest to the published checksum.
  4. If the digests match, your download is intact and untampered. If they differ, re-download from a trusted source.

Linux ISO downloads are a good example. Ubuntu, Fedora, and Debian all publish SHA-256 checksums alongside their ISO files.91011 After downloading a 4 GB image, you drop it into the File Hash Verifier, wait for the digest to compute, and compare it character by character against the published value. The entire process runs locally. The file never uploads anywhere, which matters when you’re verifying proprietary or sensitive archives.

One important boundary: general-purpose hash functions are designed to be fast, which makes them exactly the wrong choice for password storage. Storing passwords requires purpose-built algorithms like bcrypt, scrypt, or Argon2 that deliberately slow computation and include built-in salting to resist rainbow table attacks. OWASP recommends slow password hashing algorithms such as Argon2id, bcrypt, or PBKDF2 and warns that fast hashes such as SHA-256 let attackers test guesses quickly.12

Four-step file integrity verification workflow: download file and published checksum, drop file in browser, compute SHA-256 digest locally, compare digests to confirm file integrity
The digest comparison happens entirely in the browser. A 4 GB Linux ISO never touches a network interface during verification, only local disk and RAM.

Why Client-Side Hashing Matters

Developers routinely paste sensitive strings into online “free hash generator” websites. Those sites receive your data, process it, and send back the result. The site operator can log input values. By routing these payloads to a third-party server, you unknowingly transform a routine security check into a potential data leak.

CapyToolkit’s hash generator runs via WebAssembly in your browser tab. Open the Network panel in DevTools, type a string into the tool, and confirm: zero outbound requests. No data leaves your machine. The hashing engine compiles to WASM and executes in the same sandboxed environment as JavaScript, subject to the same-origin policy and browser security guarantees described in how WebAssembly modules execute sandboxed in the browser under standard JavaScript security constraints. Every computation stays local, regardless of which underlying engine handles the workload.13

The tool also works offline after the first page load. No network dependency, no account, no server-side logs. This matters when you’re hashing API keys, internal config values, data adjacent to PII, or proprietary code snippets that should not traverse a network.

Practical Language Guides for SHA-256

Browser-based verification is useful for one-off checks, but production code needs the same algorithm running in your language of choice. CapyToolkit links to language-specific SHA-256 implementation guides covering Python hashlib, JavaScript Web Crypto API, Java MessageDigest, PHP hash(), Go crypto/sha256, Node.js crypto, and C# System.Security.Cryptography. Each guide shows idiomatic code for producing the same SHA-256 digest that the browser tool generates, so the result you verified locally in the browser matches exactly what your application code produces.

This bridges the gap between “I confirmed it works in the browser” and “I need to ship this in production.” Same algorithm, same result, zero-cloud verification before you write a single line of application code. For the overall NIST guidance on which algorithms remain approved for federal use and when legacy algorithms are permitted, see which hash algorithms NIST approves for federal use and when legacy algorithms like SHA-1 remain permitted.1

Sources
  1. 1.

    Mozilla Developer Network, “SubtleCrypto: digest() method,” developer.mozilla.org, December 2025. https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest

  2. 2.

    Ronald Rivest, “The MD5 Message-Digest Algorithm,” RFC 1321, IETF, April 1992. https://www.rfc-editor.org/rfc/rfc1321

  3. 3.

    Xiaoyun Wang, Dengguo Feng, Xuejia Lai, and Hongbo Yu, “Collisions for Hash Functions MD4, MD5, HAVAL-128 and RIPEMD,” IACR Cryptology ePrint Archive, 2004. https://eprint.iacr.org/2004/199

  4. 4.

    NIST, “Research Results on SHA-1 Collisions,” csrc.nist.gov, February 2017. https://csrc.nist.gov/news/2017/research-results-on-sha-1-collisions

  5. 5.

    NIST, “The Keyed-Hash Message Authentication Code (HMAC),” FIPS 198-1, csrc.nist.gov, July 2008. https://csrc.nist.gov/pubs/fips/198-1/final

  6. 6.

    GitHub, “Validating webhook deliveries,” docs.github.com, accessed June 2026. https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries

  7. 7.

    Stripe, “Receive Stripe events in your webhook endpoint,” docs.stripe.com, accessed June 2026. https://docs.stripe.com/webhooks

  8. 8.

    Simon Josefsson, “The Base16, Base32, and Base64 Data Encodings,” RFC 4648, IETF, October 2006. https://www.rfc-editor.org/rfc/rfc4648

  9. 9.

    Ubuntu, “Ubuntu 26.04 LTS (Resolute Raccoon),” releases.ubuntu.com, accessed June 2026. https://releases.ubuntu.com/26.04/

  10. 10.

    Fedora, “Verify your Downloaded Image,” alt.fedoraproject.org, accessed June 2026. https://alt.fedoraproject.org/en/verify.html

  11. 11.

    Debian, “Index of /debian-cd/current/amd64/iso-cd,” cdimage.debian.org, accessed June 2026. https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/

  12. 12.

    OWASP Foundation, “Password Storage Cheat Sheet,” owasp.org, 2024. https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html

  13. 13.

    World Wide Web Consortium, “WebAssembly Web API,” w3.org, December 2024. https://www.w3.org/TR/2024/CR-wasm-web-api-2-20241217/

More in Developer Tools