Hash Algorithm Comparison

Hash the same input with MD5, SHA-1, SHA-2, Keccak-512 and RIPEMD-160 side by side, compare digest lengths and time each one over up to 100 runs.

The interactive tool loads here when JavaScript runs.

About this tool

What is Hash Algorithm Comparison?

This tool runs one input through eight hash functions at once: MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, Keccak-512 and RIPEMD-160. For each one you get the hex digest, its length, a short security and use-case note, and a timing measured with performance.now().

Timings are repeated 1 to 100 times and summarised as an average or a P50, P95 or P99 percentile, so you can see how noisy browser measurements are. The hashing uses the crypto-js library in your browser; nothing is uploaded.

Treat the timings as relative, not absolute. crypto-js is pure JavaScript, so it is far slower than native code and its ranking can differ from what OpenSSL or a hardware-accelerated CPU would show.

  • Eight algorithms hashed side by side from one input
  • Hex digest, length and security notes for each
  • Timing over 1 to 100 runs with average, P50, P95 or P99
  • Copy any digest with one click
  • Runs locally with crypto-js; input never leaves the browser
Read the guide: Comparing Hash Algorithms: Security Margins, Speed and the Keccak Trap

Updated

How to use Hash Algorithm Comparison

  1. Choose a Data Type preset (Text Content, Password String or File Content) or Custom Data and type your own input.
  2. Pick how many Iterations to time, from 1 to 100 runs.
  3. Choose the Statistical Metric: Average, P50, P95 or P99.
  4. Click Compare Hash Algorithms and read the Performance Summary, then each algorithm's digest, length and timing.
  5. Use the copy button beside a digest to grab it.

Worked examples

Known answer check

Input

abc

Output

SHA-256: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

This is the FIPS 180 test vector for "abc". MD5 of the same input is 900150983cd24fb0d6963f7d28e17f72, the RFC 1321 test vector.

Keccak is not SHA3

Input

empty string

Output

Keccak-512 starts 0eab42de4c3ceb92...; SHA3-512 starts a69f73cca23a9ac5...

Same sponge, different padding byte. If a library's SHA3 output does not match a published SHA3 test vector, this is the usual reason.

Background and insight

The security of a hash against collisions is roughly half its output size in bits, because of the birthday bound: with an n-bit digest you expect a collision after about 2^(n/2) attempts. That makes MD5 (128 bits) a 64-bit target before any cryptanalysis, and real attacks are far cheaper. MD5 collisions have been practical since 2004, and Google and CWI published the first SHA-1 collision, SHAttered, in 2017. Both are fine for detecting accidental corruption and unacceptable for signatures.

SHA-224 and SHA-384 are truncated versions of SHA-256 and SHA-512 with different initial values, defined in FIPS 180-4. SHA-384 hides 128 bits of internal state, which blocks the length-extension attack that affects SHA-256 and SHA-512 when they are misused as a MAC; SHA-224 hides only 32 bits, so it gives little protection. HMAC avoids the problem for all of them.

The Keccak-512 row deserves a note. crypto-js exposes a function called SHA3, but it implements the original Keccak submission. NIST changed the padding when it published SHA-3 as FIPS 202 in 2015, so the same input gives a different digest. Ethereum's Keccak-256 uses the original padding too. This tool labels the row Keccak-512 so you do not paste it somewhere that expects SHA3-512.

Common use cases

  • Picking an algorithm for a new system

    See digest sizes and relative cost side by side before choosing a checksum or signature hash.

  • Explaining why MD5 is retired

    Show a team the digest lengths and security notes for MD5 and SHA-1 next to SHA-256.

  • Cross-checking a library

    Compare a digest from your code against an independent implementation for the same input.

  • Teaching hash properties

    Change one character of the input and compare how different each new digest looks.

Tips and limitations

  • Never use any of these hashes on their own for passwords. Use bcrypt, scrypt or Argon2, which are deliberately slow and salted.
  • Text is hashed as UTF-8. A trailing newline or a Windows CRLF changes every digest, which is the most common reason two "identical" inputs disagree.
  • Short inputs finish in microseconds, so timer resolution dominates. Use 50 or 100 runs and the P50 figure for steadier numbers.
  • Browsers coarsen performance.now() to limit timing attacks, so very small timings may show as zero or repeat the same value.
  • For SHA-3 proper or BLAKE2, use a native library such as Node's crypto or OpenSSL; they are not in crypto-js.

Sources and further reading

  1. FIPS 180-4, Secure Hash Standard (SHS), National Institute of Standards and Technology. SHA-1 and the SHA-2 family, including SHA-224 and SHA-384
  2. FIPS 202, SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions, National Institute of Standards and Technology. The 2015 SHA-3 standard and its padding
  3. How to Break MD5 and Other Hash Functions, Lecture Notes in Computer Science. Wang and Yu's MD5 collision attack
  4. Announcing the first SHA1 collision, Google Online Security Blog. SHAttered, 2017
  5. RFC 2104: HMAC: Keyed-Hashing for Message Authentication, IETF

Frequently asked questions

Which hash algorithm is the most secure here?

SHA-384, SHA-512 and Keccak-512 have the largest security margins, and SHA-256 is the standard choice for nearly everything. MD5 and SHA-1 have practical collision attacks and should only be used for non-security checksums. RIPEMD-160 has no known break but a smaller 160-bit output.

Why is the SHA-3 row called Keccak-512?

Because crypto-js implements the original Keccak, which uses different padding from the final FIPS 202 SHA-3 standard. The digests do not match, so labelling it SHA3-512 would mislead anyone checking against a standard test vector.

Is SHA-512 slower than SHA-256?

Not necessarily. On 64-bit CPUs, native SHA-512 often hashes long inputs faster than SHA-256 because it processes 128-byte blocks with 64-bit words. In this tool's pure-JavaScript crypto-js code the ranking can differ, which is why the timings are only a rough comparison.

Why do the hash timings change every run?

Browser timing is noisy. Garbage collection, JIT compilation and timer coarsening all affect microsecond measurements. Repeating 50 or 100 times and reading P50 smooths that out; P99 shows the occasional slow outlier.

Can I compare hash algorithms for a file?

This page hashes text you type or paste. To hash a file's bytes and compare it with a published checksum, use the Hash File Verifier, which hashes the file locally in your browser.

Why were Whirlpool and BLAKE2 removed?

They were never real. Earlier versions showed salted SHA-512 and Keccak output under those names because crypto-js has no Whirlpool or BLAKE2. Showing a wrong digest under a real algorithm's name is worse than leaving it out, so the list now contains only genuine implementations.

Is there an in-depth guide to Hash Algorithm Comparison?

Yes. “Comparing Hash Algorithms: Security Margins, Speed and the Keccak Trap” covers the background, how it works, common pitfalls and worked examples. Read the full guide.