SHA-1 of a word
hello
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
Always 40 hex characters (160 bits).
Generate the SHA-1 hash of text or a file and verify SHA-1 checksums. SHA-1 is no longer safe against attackers, but it is still found in Git and many older systems.
hello
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
Always 40 hex characters (160 bits).
The quick brown fox jumps over the lazy dog
2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
A standard test vector used by many libraries.
da39a3ee5e6b4b0d3255bfef95601890afd80709
This value often appears in logs when something hashed empty input.
SHA-1 (Secure Hash Algorithm 1) turns any input into a 160-bit hash, written as 40 hexadecimal characters. It was published by NIST in 1995 and was the standard secure hash for over a decade, used in TLS certificates, PGP, SSH and code signing.
No. In 2017, Google and CWI Amsterdam published SHAttered: two different PDF files with the same SHA-1 hash. In 2020, a "chosen-prefix" collision made attacks practical for real formats. Browsers stopped trusting SHA-1 certificates in 2017, and NIST has scheduled SHA-1 to be retired completely by 2030.
| Use | SHA-1 OK? |
|---|---|
| Detecting accidental corruption | Yes |
| Identifying objects in an existing Git repository | Yes (Git adds collision detection) |
| Signatures, certificates, verifying downloads against tampering | No: use SHA-256 |
| Passwords | Never |
Every Git commit, tree and file is identified by a SHA-1 hash, which is why commit IDs are 40 characters long (or a short prefix such as 2fd4e1c). Since SHAttered, Git uses a hardened SHA-1 that detects the known collision attack, and newer versions can create repositories with SHA-256 object IDs (git init --object-format=sha256).
Note that Git does not hash the raw file: it hashes blob <size>\0 followed by the content, so git hash-object gives a different value from a plain SHA-1 of the same file.
echo -n 'hello' | sha1sum # Linuxshasum -a 1 file.zip # macOSsha1('hello'); // "aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d"sha1_file('file.zip');import hashlibhashlib.sha1(b'hello').hexdigest()// Browserconst hash = await crypto.subtle.digest('SHA-1', new TextEncoder().encode('hello'));My SHA-1 differs from git hash-object
Git hashes a header (blob <size>\0) plus the content, not the content alone. Both values are correct for what they hash.
My SHA-1 differs from the terminal
echo adds a newline. Use echo -n or printf to hash exactly the text.
A tool or browser warns that SHA-1 is insecure
That is expected for signatures and certificates. Switch those to SHA-256; plain checksums for corruption are still fine.
160 bits: 40 hexadecimal characters, or 28 characters in Base64.
Yes, for collision resistance: two different files with the same SHA-1 can be created. It still detects accidental changes.
SHA-256 for checksums and signatures, SHA-3 or BLAKE3 as modern alternatives, and bcrypt or Argon2 for passwords.
No. The hash is calculated in your browser.
Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.
Tip: press Ctrl D to bookmark dev247.