sha1 hash generator online

Legacy

Create the sha1 hash of any text: 40 hex characters, the same result as PHP's hash(). Check a hash or a file below. Nothing leaves your browser.

Runs in your browser
A hash is one-way. It can't be turned back into the text.
Check & convert

Compare, hash a file, copy any format

Type text in the tool above or choose a file. Case, spaces and prefixes like sha1: don't matter.

Formats for hello world
Hex
2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
HEX (upper case)
2AAE6C35C94FCFB415DBE95F408B9CE91EE846ED
Base64
Kq5sNclPz7QV2+lfQIuc6R7oRu0=

Files are read in your browser and never uploaded.

In short

What is SHA-1?

SHA-1 produces a 160-bit hash, written as 40 hex characters. NIST published it in 1995; in 2017 the SHAttered attack showed two different PDF files with the same SHA-1. Git still identifies objects with (hardened) SHA-1, but for signatures and certificates SHA-1 is no longer accepted.

BrokenCollisions can be produced on purpose. Don't use it where an attacker could profit.
Where you meet it
  • Git object IDs
  • Legacy systems and old signatures
  • HMAC-SHA1 (still acceptable)
  • Checksums of old downloads
Try it

Change one letter, see what happens

A cryptographic hash changes about half of all bits when one input character changes. Nothing about the old hash tells you what the new one will be.

Hash A…
Hash B…

Calculating…

"Decrypt" SHA-1?

Is it a common password?

No one can decrypt a hash. What "decrypt" sites do is compare it with hashes of known words. This check does the same in your browser with about 11,000 common passwords, PINs and years, so you can see how quickly weak passwords fall.

Nothing is sent anywhere. The list is part of this page.

Use it in code

The same result in your code

Every snippet prints 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed for hello world, the same as the tool. They are run against PHP's hash() before each release.

PHP
echo hash('sha1', 'hello world');
Python
import hashlib

print(hashlib.sha1("hello world".encode()).hexdigest())
Node.js
import { createHash } from "node:crypto";

console.log(createHash("sha1").update("hello world").digest("hex"));
Browser
const data = new TextEncoder().encode("hello world");
const buf = await crypto.subtle.digest("SHA-1", data);
console.log([...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, "0")).join(""));
Java
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.HexFormat;

public class Hash {
  public static void main(String[] args) throws Exception {
    byte[] digest = MessageDigest.getInstance("SHA-1")
        .digest("hello world".getBytes(StandardCharsets.UTF_8));
    System.out.println(HexFormat.of().formatHex(digest)); // Java 17+
  }
}
Go
package main

import (
	"fmt"
	"crypto/sha1"
)

func main() {
	fmt.Printf("%x\n", sha1.Sum([]byte("hello world")))
}
Command line
printf '%s' 'hello world' | sha1sum

# macOS: printf '%s' 'hello world' | shasum -a 1
# File on Windows: certutil -hashfile file.zip SHA1
Test values

SHA-1 test values

Hashes of common test strings (UTF-8, no line break). Use them to check your own implementation.

Inputsha1
empty stringda39a3ee5e6b4b0d3255bfef95601890afd80709
abca9993e364706816aba3e25717850c26c9cd0d89d
hello world2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
The quick brown fox jumps over the lazy dog2fd4e1c67a2d28fced849ee1bb76e7391b93eb12

SHA-1 hashes of the 5 most common passwords

These five lead the public lists of leaked passwords year after year, so their hashes are in every cracking list too. If you see one of these values in a database, the password is known. Paste one into the password check above to see it found in a split second.

Passwordsha1
1234567c4a8d09ca3762af61e59520943dc26494f8941b
password5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
123456789f7c3bc1d808e04732adf679965ccc34ca7ae3441
123456787c222fb2927d828af22f592134e8932480637c0d
123458cb2237d0679ca88db6464eac60da96345513964
Common mistakes

Why your SHA-1 doesn't match

Git hashes more than the content

git hash-object hashes "blob <size>\0" plus the content, so a file's Git ID is not the plain SHA-1 of the file.

Length extension

With SHA-256, SHA-512, SHA-1 and MD5, hash(secret + message) is not a safe signature: an attacker can append data and compute a valid hash without the secret. Use HMAC.

Not for passwords

A fast hash lets attackers try billions of guesses per second. Store passwords with Argon2id, bcrypt or scrypt, which are slow on purpose and use a salt.

A line break sneaks in

echo "hello world" | sha256sum hashes 12 bytes: the text plus a line break. Use printf '%s' 'hello world' or echo -n to hash exactly 11 bytes.

Same text, different bytes

The tool hashes UTF-8 bytes, like most languages. Windows APIs and .NET's Encoding.Unicode use UTF-16, older systems Latin-1. "ü" is 2 bytes in UTF-8, 1 in Latin-1, 2 in UTF-16, and each gives a different hash.

Upper or lower case

Hex is not case-sensitive: 5EB63BBB… and 5eb63bbb… are the same hash. Compare in one case, and watch for spaces or a prefix like "sha256:".

Compare

The MD and SHA-1 family side by side

The same text, every MD and SHA-1 algorithm. Shown for hello world; type in the tool above to use your text.

AlgorithmHashBits
md2d9cce882ee690a5c1ce70beff3a78c77128
md4aa010fbc1d14c795d86ef98c95479d17128
md55eb63bbbe01eeed093cb22bb8f5acdc3128
sha12aae6c35c94fcfb415dbe95f408b9ce91ee846ed160
Measured on your device

How fast is SHA-1?

Hashes up to 4 MB of random data in your browser and compares with sha256, xxh3. Browser numbers are lower than native code, but the ranking holds.

FAQ

Questions about SHA-1

Can SHA-1 be decrypted?

No. SHA-1 is a one-way function: there is no key and no way to compute the input from the hash. Sites that "decrypt" SHA-1 look the hash up in large tables of known inputs, which only works for short or common strings.

How long is a SHA-1 hash?

A SHA-1 hash is always 160 bits, written as 40 hexadecimal characters (20 bytes), no matter how long the input is.

Is SHA-1 secure?

No. Collisions for SHA-1 can be created on purpose, so it must not be used for signatures, certificates or anything an attacker could exploit. It is still fine to detect accidental corruption.

Should I hash passwords with SHA-1?

No. SHA-1 is fast, so attackers can test huge numbers of guesses. Use Argon2id, bcrypt or scrypt with a unique salt per password.

Is SHA-1 still used?

Yes, mainly in Git and in older systems. Browsers stopped trusting SHA-1 TLS certificates in 2017.

Good to know

Before you rely on it

Searches the list of pages on this site. What you type stays in your browser.