>_ MoriDev dev.moritools.com
Web Crypto API 100% Client-Side · Zero Upload

SHA-256 / SHA-512 / SHA-1 / HMAC Local Hash Generator

Compute SHA-256, SHA-512, SHA-384, SHA-1, and HMAC webhook signatures for text or local files using native Web Crypto.

Ready (Offline)
Quick Summary

Hash UTF-8 text or drag any local binary file (tarball, ISO, release artifact) to compute hardware-accelerated SHA-256, SHA-512, SHA-384, SHA-1, and optional HMAC-SHA256/512 signatures strictly via browser crypto.subtle.

Verifying a downloaded release checksum or debugging a failing Stripe/GitHub X-Hub-Signature-256 webhook header requires hashing raw payloads and signing secrets that must never leave your workstation.

Powered directly by the browser native SubtleCrypto engine (AES/SHA hardware instructions where available), this tool computes four standard SHA digests simultaneously and unlocks HMAC-SHA256 and HMAC-SHA512 output the moment you supply a signing key.

Cryptographic Hashing & Webhook Verification Pitfalls

01. Trailing Newline Mismatch in CLI vs Browser Hashes

Running echo "hello" | shasum -a 256 hashes "hello\n" (6 bytes), whereas printf "hello" hashes 5 bytes. Always verify byte length when comparing hashes across terminal and web tools.

02. Re-Serializing JSON Before Verifying Webhook HMACs

HMAC signatures cover the exact raw HTTP request body bytes. Parsing req.body into JSON and calling JSON.stringify again alters whitespace or key ordering and invalidates every signature check.

03. Using Raw SHA-256 for Password Storage or SHA-1 for Security

SHA-1 is cryptographically broken for collision resistance (SHAttered attack), and fast unkeyed SHA-256 can be brute-forced at billions of guesses per second on GPUs. Always use Argon2id, scrypt, or bcrypt for user passwords.

Digest Length & Security Posture

Algorithm Digest Size Recommended Role
SHA-256 256 bits (64 hex chars) Release checksums, GitHub/Stripe HMAC, TLS certificates
SHA-512 512 bits (128 hex chars) High-margin file integrity, 64-bit CPU throughput
SHA-384 384 bits (96 hex chars) Truncated SHA-512 immune to length-extension attacks
SHA-1 160 bits (40 hex chars) Legacy Git object IDs & checksum compatibility only
HMAC-SHA256 Keyed 64 hex chars Webhook authentication & API request signing

Worked Engineering Examples

Known SHA-256 Empty-Input Vector

Input
(empty string — 0 bytes)
Output
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

NIST FIPS 180-4 empty message vector confirms exact Web Crypto SHA-256 compliance.

Signing a Webhook Body With HMAC-SHA256

Input
Payload: {"event":"paid"} · Secret: whsec_demo
Output
Deterministic 64-char hex MAC matching Node crypto.createHmac("sha256", secret)

Useful for reproducing webhook headers locally without exposing signing secrets to remote debuggers.

Frequently Asked Questions

Does dropping a file upload it to MoriDev servers?

Never. The file is read locally via File.arrayBuffer() and passed straight to window.crypto.subtle.digest in your browser memory.

Why is MD5 omitted in favor of SHA-256 and Web Crypto?

Web Crypto (crypto.subtle) intentionally excludes MD5 because MD5 collisions can be forged in seconds on a laptop. SHA-256 and SHA-512 are the modern integrity standards.

Why does my SHA-256 differ from `echo text | sha256sum`?

The Unix echo command appends a trailing newline (\n) by default. Use `printf "%s" "text" | sha256sum` to hash the exact string without an extra newline.

How should my backend compare HMAC digests safely?

Always compare expected and received HMAC buffers with a constant-time routine such as Node crypto.timingSafeEqual to prevent timing side-channel leaks.

Continue Your Workflow

24 offline developer utilities