A complete guide to MD5, SHA-1, SHA-256, and SHA-512 hashing, how the MD5 implementation was verified, and why SHA hashes require a secure browser context.
Launch the Hash Generator →The Hash Generator computes four widely used cryptographic hash functions — MD5, SHA-1, SHA-256, and SHA-512 — for any text you type or any file you select, displaying all four results simultaneously so you can compare them side by side. It supports both direct text input and file hashing, making it useful both for quick ad-hoc checks and for verifying the integrity of downloaded files.
All four hashes are computed and displayed together automatically, rather than requiring you to pick a single algorithm up front, since different situations call for different hash algorithms, and having all four available at once avoids needing to re-run the tool multiple times to compare them.
A cryptographic hash function takes an input of any size — a single word, an entire book, or a multi-gigabyte file — and produces a fixed-length output (called a hash, digest, or checksum) that acts as a kind of unique fingerprint for that specific input. Changing even a single bit of the input, no matter how small that change is, produces a completely different, unrelated-looking hash output, which is precisely the property that makes hashes useful for integrity verification: if two files produce the same hash, they are, for all practical purposes, identical; if they produce different hashes, they are different, even if the difference is a single invisible character.
Hash functions are deliberately one-way: there's no way to reverse a hash back into its original input, which is a fundamentally different property from encryption (which is designed to be reversible by someone with the right key). This one-way property is exactly what makes hashes useful for things like storing password verification data without storing the actual password, and for confirming file integrity without needing to compare entire file contents byte-by-byte.
MD5 produces a 128-bit hash and was, for a long time, the most commonly used general-purpose hash algorithm. It is now considered cryptographically broken for security purposes: researchers have demonstrated practical methods to deliberately construct two different inputs that produce the same MD5 hash (called a collision), which completely defeats its usefulness for any application where an adversary might want to forge a matching hash. MD5 remains in widespread use today purely for non-adversarial integrity checking, such as confirming a file wasn't accidentally corrupted during a transfer, where no malicious actor is trying to deliberately engineer a collision.
SHA-1 produces a 160-bit hash and was designed as MD5's successor, but has itself since been shown to be vulnerable to practical collision attacks (a landmark 2017 demonstration by Google and CWI Amsterdam produced two different PDF files with an identical SHA-1 hash). Like MD5, it's now considered unsuitable for security-critical applications but remains acceptable for simple, non-adversarial integrity checks.
SHA-256 produces a 256-bit hash and is part of the SHA-2 family, currently considered cryptographically strong and suitable for security-sensitive applications, including digital signatures, blockchain systems, and password-related security infrastructure (though not for directly hashing passwords themselves, which calls for specialized, deliberately slow algorithms like bcrypt or Argon2 instead). SHA-512, also part of the SHA-2 family, produces a larger 512-bit hash and offers an even higher security margin, generally at a modest additional computational cost, making it a reasonable choice when the strongest practical hash strength is desired.
Because MD5 is not provided by the browser's native Web Crypto API (which only implements the modern SHA family), this tool uses a separate, standalone JavaScript implementation of the MD5 algorithm specifically to support it. Implementing a cryptographic hash algorithm from its specification is exactly the kind of task where a subtle, easy-to-miss error (an incorrect bit rotation amount, a wrong constant value, a byte-ordering mistake) can produce an implementation that runs without any errors and produces hash-looking output, while being silently, completely wrong.
To guard against exactly that risk, the MD5 implementation used in this tool was tested against the official, published MD5 test vectors before being included in the shipped tool: known input strings with publicly documented, verified correct MD5 outputs, including the hash of an empty string, the word "hello," the string "abc," and the standard pangram test sentence used throughout cryptographic test suites. Each of these known inputs was run through the implementation and the resulting hash was confirmed to exactly match the publicly documented correct answer before the code was considered trustworthy enough to ship. This verify-against-known-vectors approach is the standard, correct way to confirm a cryptographic implementation is accurate, rather than simply assuming code that compiles and runs without errors is necessarily producing correct output.
After downloading a software installer, many publishers list the file's official SHA-256 checksum on their download page specifically so you can verify the download wasn't corrupted or tampered with in transit. Selecting the downloaded file in this tool and comparing its calculated SHA-256 hash against the publisher's published value confirms, with extremely high confidence, that you received an exact, unmodified copy of the intended file.
Beyond the general concept of integrity verification, a few specific, recurring situations illustrate when having quick access to multiple hash algorithms genuinely matters:
The SHA-1, SHA-256, and SHA-512 hashes in this tool are computed using the browser's native Web Crypto API (crypto.subtle), which comes with a hard, deliberate browser security restriction: it is only available in what's called a "secure context" — meaning the page must be loaded over HTTPS, or accessed via localhost or a loopback address like 127.0.0.1.
This means that if this tool, or any page using the same Web Crypto functionality, were somehow accessed over plain, unencrypted HTTP on a non-localhost hostname (for instance, a self-hosted internal server reached by its plain network name over HTTP rather than HTTPS), the three SHA hash outputs would correctly show as unavailable, since crypto.subtle itself would be undefined in that non-secure context. This is a deliberate browser security policy, not a bug or limitation of this tool's own code — browser vendors restrict certain powerful APIs, including cryptographic functions, to secure contexts specifically to reduce the risk of those capabilities being abused over connections that could be intercepted or tampered with by a network attacker. The MD5 implementation, being a standalone JavaScript function rather than a Web Crypto API call, is not subject to this same restriction and will continue to function regardless of the page's security context.
All hash calculations, for both text and file input, happen entirely within your browser using the Web Crypto API (for SHA family hashes) and a local, standalone implementation (for MD5). No network request of any kind is made by this tool, and neither the text you type nor the file you select is ever transmitted anywhere, logged, or stored — file contents are read directly from your local disk into browser memory for hashing and are never uploaded.
Both remain useful for simple, non-adversarial integrity checking (confirming a file wasn't accidentally corrupted), even though they're no longer considered secure against a deliberate, malicious attacker trying to engineer a matching hash for different content. For anything security-sensitive, SHA-256 or SHA-512 are the appropriate choices.
This happens when the page is accessed over plain HTTP on a non-localhost address, since the Web Crypto API that provides the SHA family hashes is deliberately restricted by browsers to secure contexts (HTTPS or localhost) only, as explained in detail above.
This tool computes general-purpose cryptographic hashes, which are not the right tool for password storage specifically — dedicated password-hashing algorithms like bcrypt or Argon2 are deliberately slow and include additional security measures that general-purpose hashes like SHA-256 lack.
It was tested against the official, published MD5 test vectors (known inputs with documented correct outputs) before being included in this tool, exactly as described in the MD5 verification section above.