How to use
- Enter text, switch the input to hex bytes, or open a file.
- SHA-1 is preselected; change the Algorithm select if you want to compare it with another hash function.
- Pick lowercase hex (as printed by sha1sum and Git), uppercase hex or Base64.
- Paste an expected SHA-1 into the Compare with field; the page shows Match or No match.
What is SHA-1?
SHA-1 (Secure Hash Algorithm 1) was designed by the NSA and published by NIST in 1995 as FIPS 180-1, replacing the short-lived SHA-0. It is now specified in FIPS 180-4, and RFC 3174 describes it with sample C code. SHA-1 processes 512-bit blocks in 80 rounds and outputs a 160-bit digest: 40 hex characters or 28 Base64 characters.
Like any hash, SHA-1 is one-way. A digest cannot be decrypted, only matched by hashing guesses. That is how the unsalted SHA-1 password hashes leaked from LinkedIn in 2012 were cracked in bulk; passwords belong in Argon2, scrypt, bcrypt or PBKDF2.
SHAttered: why SHA-1 is deprecated
In February 2017 researchers from CWI Amsterdam and Google published SHAttered, the first real SHA-1 collision: two different PDF files with the same hash, found with roughly 2^63 SHA-1 computations. In 2020 Gaëtan Leurent and Thomas Peyrin ("SHA-1 is a Shambles") used a chosen-prefix collision to demonstrate forged SHA-1 signatures on PGP keys, at a cost within reach of a well-funded attacker.
- Public CAs stopped issuing SHA-1 TLS certificates in 2016, and browsers stopped trusting them in early 2017.
- NIST has disallowed SHA-1 for new digital signatures since 2013 and plans to retire it completely by the end of 2030.
- Most Git repositories still identify objects by SHA-1, computed with a hardened implementation that detects collision attempts; Git can also create repositories that use SHA-256.
Collisions do not break HMAC, so HMAC-SHA1 is still found in TOTP codes and older webhook signatures; compute it with the HMAC Generator. For anything new, choose SHA-256.
Git object IDs, Base64 and text encoding
A Git blob ID is not the SHA-1 of the file alone. Git hashes a header made of blob, a space, the size in bytes and a zero byte, followed by the content. To reproduce it here, switch the input to hex and include those header bytes: for hello plus a newline, the hex input is 626c6f6220360068656c6c6f0a.
$ printf 'hello\n' | sha1sum
f572d396fae9206628714fb2ce00f72e94f2258f -
$ printf 'hello\n' | git hash-object --stdin
ce013625030ba8dba906f756967f9e9ca394464a
SHA-1 is usually shown as lowercase hex. Base64 appears in the WebSocket handshake, where Sec-WebSocket-Accept is the Base64 SHA-1 of the client key plus a fixed GUID, and in LDAP {SHA} password values. Remember that the hash covers bytes: text with accented letters has one SHA-1 in UTF-8 and another in Windows-1252.
SHA-1 on the command line and in code
sha1sum file.zip # Linux
shasum file.zip # macOS (SHA-1 is the default)
certutil -hashfile file.zip SHA1 # Windows
Get-FileHash file.zip -Algorithm SHA1 # PowerShell
# Python
hashlib.sha1(data).hexdigest()
// Node.js
crypto.createHash('sha1').update(data).digest('hex')
This page computes SHA-1 with the Web Crypto API built into your browser, so the input never leaves your device. The table of all algorithms shows the MD5, SHA-256, SHA-384, SHA-512 and CRC values of the same input.
Examples
| Input (UTF-8) | SHA-1 |
|---|---|
Hello, World! | 0a0a9f2a6772942557ab5355d76af442f8f65e01 |
Base64.is | 6c667ee2efd2020349eed40efa07c26683f613c8 |
你好 | 440ee0853ad1e99f962b63e459ef992d7c211722 |
Frequently asked questions
Is SHA-1 still safe to use?
Not where an attacker can choose or influence the input, such as signatures and certificates, because SHA-1 collisions can be produced. It still detects accidental corruption, and HMAC-SHA1 is not affected by collisions. For new work, use SHA-256 or SHA-512.
Can a SHA-1 hash be reversed?
No. There is no key and no decryption. Lookup sites only find inputs that are already in their tables of common words and leaked passwords, which is why a long random input is safe from them and a short password is not.
How long is a SHA-1 hash?
=. RIPEMD-160 has the same length, and MySQL 4.1+ password hashes are an asterisk followed by 40 hex characters. The Hash Identifier lists the candidates for a given string.How do I check a file against a published SHA-1?
Open the file, then paste the published value into the Compare with field. Uppercase or lowercase hex and Base64 are all accepted, and the page shows Match or No match.
What is the difference between SHA-1 and SHA-256?
Both were published by NIST, but SHA-256 belongs to the newer SHA-2 family, has a 256-bit output and no known practical attacks. SHA-1 has a shorter output and its collision resistance is broken.