What SHA-1 is
SHA-1 is a hash function published by NIST in 1995. It turns any input into a 160-bit value, written as 40 hexadecimal characters. For about twenty years it was the standard hash for certificates, software signing and version control.
| Input | SHA-1 |
|---|---|
| (empty) | da39a3ee5e6b4b0d3255bfef95601890afd80709 |
| hello | aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d |
| password | 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 |
SHA-1 is broken for security
In 2017 researchers from Google and CWI Amsterdam published SHAttered, the first practical SHA-1 collision: two different PDF files with the same hash. Later attacks made collisions cheaper still. Anyone who relies on SHA-1 to prove that data was not tampered with can be fooled, so certificates and signatures have moved to SHA-256.
SHA-1 is still fine for spotting accidental changes and for matching data against older systems that only publish SHA-1 values. For anything new, use SHA-256.
SHA-1 on your own computer
On macOS, shasum without options uses SHA-1. The checker above accepts a line copied from sha1sum, with the file name after the hash.
Questions about SHA-1
Can a SHA-1 hash be decoded?
No. SHA-1 is a one-way hash, so the original text is not stored in it. Tools that claim to decode SHA-1 look the hash up in lists of hashes made from common words and leaked passwords. Short, common inputs can be found that way; anything long and random cannot.
Is SHA-1 still safe?
Not for security. In 2017 Google and CWI Amsterdam published the first practical SHA-1 collision, two different PDF files with the same hash. Browsers stopped trusting SHA-1 certificates around that time. Use SHA-256 for anything new.
Why does Git use SHA-1?
Git names every commit and file by its SHA-1 hash. Since 2017 it uses a hardened version that detects the known collision attacks, and newer versions can also store repositories with SHA-256.
How long is a SHA-1 hash?
160 bits, written as 40 hexadecimal characters.
Is my text or file sent to a server?
No. Hashing runs in your browser with the built-in Web Crypto API. Neither the text nor the file is uploaded.