A cryptographic hash function maps an input of any size to a fixed-length output (the digest), with two critical properties: the same input always produces the same output, and finding two distinct inputs that hash to the same output (a collision) should be computationally infeasible. It's the building block of digital signatures, password storage, integrity checking, and Merkle trees.
This generator implements four standard digests - MD5 (128-bit, RFC 1321), SHA-1 (160-bit, FIPS 180-4), SHA-256 (256-bit), and SHA-512 (512-bit) - plus all four HMAC variants per RFC 2104. The fast SHA family runs through the browser's native Web Crypto API (window.crypto.subtle.digest), which the browser implements in optimized C++ and exposes as a Promise-based interface. MD5 isn't available in Web Crypto by design (it's deprecated for security), so it routes through the crypto-js library, which provides a portable JavaScript implementation.
Why dual implementations? Web Crypto is faster and more trustworthy (constant-time, audited C++) but supports only the modern SHA family. crypto-js is slower (pure JavaScript) but covers MD5, MD4, and HMAC variants on top of MD5. The hybrid here gives you Web Crypto speed for SHA-1/256/512 and crypto-js compatibility for MD5 - the same approach Node.js' crypto module takes internally.
Security state of the art in 2026: MD5 has been broken since 2004 (collisions can be found in seconds on a laptop) - use it only for non-security checksums like cache keys and content-addressable lookups. SHA-1 has been broken since the SHAttered attack in 2017 - GitHub still uses it for commit hashes (because of historical backwards compatibility) but every TLS certificate authority abandoned it in 2017. SHA-256 and SHA-512 remain secure and are the right defaults for any new system. SHA-3 (Keccak) is also secure but isn't in this tool because Web Crypto doesn't support it.
HMAC (Hash-based Message Authentication Code) wraps a hash function with a secret key to produce a value that can't be forged without knowing the key. It's the basis of JWT's HS256 algorithm, AWS request signing (SigV4 uses HMAC-SHA256), webhook signatures from Stripe, GitHub, Slack, and basically every API security scheme that doesn't use full asymmetric cryptography. The construction prepends the key (padded to the block size) twice with different XOR pads, which is what makes it resistant to length-extension attacks that plain hash(key + message) suffers from.
File hashing reads the entire file into an ArrayBuffer with file.arrayBuffer(), then runs all four digests in parallel via Promise.all. For files up to a few hundred MB this is comfortably fast. For multi-gigabyte files the bottleneck is the in-memory buffer - real-world tools (sha256sum, openssl) stream chunks instead. If your file is too big for browser memory, fall back to the OS command-line tools.
Privacy: text inputs and file contents are processed entirely in your tab. Web Crypto runs locally, crypto-js is just JavaScript, and there's no telemetry or upload. The hash you see is the same byte string that openssl dgst -sha256 file.bin or sha256sum file.bin would produce on your machine, so you can use the output to verify downloads without trusting this page.