MD5 vs SHA-256: which checksum to use

Kitwise guide ยท updated

A download page lists a long string of letters and numbers next to the file. That is a checksum, and comparing it with your copy tells you whether the file arrived intact. This guide explains MD5 and SHA-256 and when each is appropriate.

Free tools for this

1. What a hash is

A hash function turns any input into a fixed-length fingerprint. The same input always gives the same fingerprint, and a tiny change gives a completely different one. For the text abc:

AlgorithmLengthHash of โ€œabcโ€
MD5128 bits (32 hex characters)900150983cd24fb0d6963f7d28e17f72
SHA-256256 bits (64 hex characters)ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

Both values were produced by the Kitwise tools and match the published test values for these algorithms.

2. Why MD5 is not safe for security

Researchers can create two different files with the same MD5 hash. That means an MD5 checksum cannot prove a file was not swapped by an attacker, and MD5 must never be used to store passwords. SHA-1 has the same problem. SHA-256 has no known practical collisions.

3. When MD5 is still fine

4. Verify a download

  1. Find the checksum on the official download page and note the algorithm (usually SHA-256).
  2. Open the File Checksum tool and choose the downloaded file; it is read in your browser, not uploaded.
  3. Compare the two values. They must match exactly; if not, download again from the official site.

Tip: A matching checksum proves the file is the one listed on that page, not that the page itself is trustworthy. Download from the official site.

Questions

Can an MD5 hash be reversed?

Not directly, but short or common inputs can be found in lookup lists, which is another reason not to use MD5 for passwords.

Which hash should I use for passwords?

None of these on their own. Use a password hashing method such as bcrypt, scrypt or Argon2.

Is SHA-256 the same as SHA-2?

SHA-256 is one member of the SHA-2 family, which also includes SHA-384 and SHA-512.

More guides All tools