OmniFeed Search

Hash generator

As you type, the hasher shows the MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes of your text's UTF-8 bytes. MD5 and SHA-1 are broken for security, so use them only to match a checksum someone has already published. It runs in your browser; nothing you enter is uploaded.

MD5
SHA-1
SHA-256
SHA-384
SHA-512

Which algorithm to use

AlgorithmDigestUse it for
MD5128 bits, 32 hex digitsMatching an MD5 checksum that's already published
SHA-1160 bits, 40 hex digitsMatching an existing SHA-1 value, such as a Git commit ID
SHA-256256 bits, 64 hex digitsChecksums, signatures, and content IDs
SHA-384384 bits, 96 hex digitsWhen a standard or protocol requires it
SHA-512512 bits, 128 hex digitsWhen a standard or protocol requires it; Ed25519 signatures use it inside

Pick SHA-256 unless you're matching a value made with something else. MD5 sits first in the list only because old downloads and systems still publish it. MD5 is defined in RFC 1321 from 1992. SHA-1 and the SHA-2 family, which covers SHA-256, SHA-384, and SHA-512, are defined in NIST's FIPS 180-4.

Why MD5 and SHA-1 are broken

A hash is broken for security once someone can make two different inputs with the same digest, which is called a collision. Xiaoyun Wang and her colleagues published MD5 collisions in 2004, and in 2012 the Flame malware used an MD5 collision to forge a Microsoft code-signing certificate. Google and CWI Amsterdam published the first SHA-1 collision in 2017 and called it SHAttered: two different PDF files with the same hash. NIST has said SHA-1 should be retired by the end of 2030.

Finding an input that matches a digest you're given is a harder problem, and nobody has a practical attack on it for either algorithm. So a published MD5 or SHA-1 checksum still catches a download that was cut short or corrupted. It doesn't prove the file is the one the author released, because an attacker could have prepared two files that share a digest. To check that, compare a SHA-256 hash taken from a source the attacker can't edit.

Don't use these for passwords

Don't store passwords as SHA-256 or MD5 hashes, even with a salt. These functions are built to be fast, so anyone with a copy of the database can test guesses at high speed on an ordinary graphics card. Password hashing functions are slow on purpose, and Argon2id and scrypt also need a lot of memory for each guess. The OWASP Password Storage Cheat Sheet recommends Argon2id first, then scrypt, then bcrypt for older systems, and PBKDF2 where you need FIPS-140 compliance. Use your language's library for one of them.

To prove a message came from someone who holds a secret key, use HMAC, such as HMAC-SHA256 from RFC 2104, rather than hashing the key and the message together.

Hashes on the command line

printf '%s' 'hello' | md5sum         # 5d41402abc4b2a76b9719d911017c592
printf '%s' 'hello' | sha256sum      # 2cf24dba5fb0a30e26e83b2ac5b9e29e...
shasum -a 256 file.iso               # macOS
Get-FileHash file.iso -Algorithm MD5 # Windows PowerShell
certutil -hashfile file.iso SHA256   # Windows Command Prompt

Use printf or echo -n, not plain echo. Plain echo adds a newline, and hello with a newline on the end has a completely different hash.

The hasher works on exactly the characters in the box, so a line break left at the end changes the whole digest. Browsers also turn every line break in a text box into a single LF character, so text pasted from a Windows file with CRLF line endings gets a different hash in the box than the file itself does. The hasher only takes text, so to check a downloaded file, use one of the commands above.

Hex digests don't depend on case: the uppercase digest Get-FileHash prints is the same as the lowercase one the hasher shows.

More in security and IDs

Other tools