Type or paste text to see its SHA-1 hash instantly, or drop files to get their SHA-1 checksums. Switch between hex and Base64, add a key for HMAC-SHA1, reproduce a Git blob ID, and compare against an expected hash. Everything runs locally in your browser.
Last updated:
0 characters · 0 bytes
Advertisement
Advertisement
How to use the SHA-1 Hash Generator
Choose Text or Files. Type or paste text, or drop one or more files onto the box.
Read the SHA-1 below the input: it updates as you type and appears as soon as a file is hashed.
Pick the format: hex (40 characters, optionally uppercase) or Base64 (28 characters).
Optional: tick HMAC-SHA1 and enter a key to sign a message, or Git blob hash to get the object ID Git would give the file.
Paste an expected hash into the compare box to verify a download, then copy or download the result.
SHA-1 test vectors
Known values to check any SHA-1 implementation (FIPS 180-4 examples and common references). Type the input above without the quotes.
Input
SHA-1
"" (empty string)
da39a3ee5e6b4b0d3255bfef95601890afd80709
"abc"
a9993e364706816aba3e25717850c26c9cd0d89d
"abc" as Base64
qZk+NkcGgWq6PiVxeFDCbJzQ2J0=
"The quick brown fox jumps over the lazy dog"
2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
HMAC-SHA1, key "key", same sentence
de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9
Git blob of an empty file
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
How SHA-1 works
SHA-1 pads the message with a 1 bit, zeros and the 64-bit message length so that it fills whole 512-bit blocks. Each block is expanded into 80 32-bit words, and 80 rounds of rotations, additions and the bitwise functions Ch, Parity and Maj mix them into five 32-bit state words (A to E). After the last block the five words, written one after another, are the 160-bit hash.
A Git blob ID is simply SHA-1("blob " + size + "\0" + content). That is why git hash-object gives a different value from sha1sum for the same file.
SHA-1 (Secure Hash Algorithm 1) is a hash function published by NIST in 1995 and specified in FIPS 180-4. It turns any input into a 160-bit value, usually written as 40 hexadecimal characters. For example, the SHA-1 of "abc" starts with a9993e36 (the full value is in the test vectors table below).
Is SHA-1 still secure?
Not against collisions. In 2017 the SHAttered attack produced two different PDF files with the same SHA-1, and later chosen-prefix attacks made collisions cheaper still. Do not use SHA-1 for digital signatures or certificates. It is still fine as a checksum to detect accidental corruption, for legacy compatibility, and inside HMAC-SHA1, which is not broken by these collision attacks.
Why is my SHA-1 different from another tool?
The hash covers every byte. This tool hashes text as UTF-8 exactly as typed. A trailing newline (echo adds one), Windows CRLF line endings, extra spaces or a different text encoding all change the result. Use printf '%s' instead of echo on the command line to avoid the newline.
How does Git use SHA-1?
Git names each object by the SHA-1 of a header plus the content. For a file (blob) that is the text "blob ", the size in bytes, a zero byte and then the content. Tick Git blob hash to get the same value as git hash-object. An empty file gives the blob ID that starts with e69de29b.
What is HMAC-SHA1?
HMAC-SHA1 combines a secret key with SHA-1 (RFC 2104) to authenticate a message. It is used by OAuth 1.0 signatures, many webhook signatures and the TOTP codes of authenticator apps (RFC 6238). HMAC-SHA1 is still considered secure because its security does not rely on SHA-1 collision resistance.
How do I get a SHA-1 checksum on my computer?
On Linux run sha1sum file, on macOS run shasum file (SHA-1 is the default) or shasum -a 1 file, and in Windows PowerShell run Get-FileHash file -Algorithm SHA1. The Command Prompt tool certutil -hashfile file SHA1 works too.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.