Skip to content

SHA-1 Hash Generator - Generate SHA-1 Hashes Online

SHA-1 Hash
—

Generate a SHA-1 Hash

Paste or type text and the 40-character SHA-1 digest appears below. The text is encoded as UTF-8 and hashed with the browser's Web Crypto API, so the result matches printf '%s' "text" | sha1sum on Linux or shasum on macOS. Nothing is uploaded.

Where SHA-1 Is Still Used

  • Git. Commit, tree, blob and tag IDs are SHA-1 by default. Git hashes a type-and-size header with the content, which is why hashing a file's text here does not give its blob ID. Git can use SHA-256 instead (git init --object-format=sha256), but most hosting and tooling still expects SHA-1 repositories.
  • TOTP codes. Most authenticator apps generate six-digit codes with HMAC-SHA1, the RFC 6238 default.
  • Have I Been Pwned. The Pwned Passwords API takes the first five hex characters of a password's SHA-1, so you can check a password without sending it. The SHA-1 of password starts with 5baa6.
  • Older checksums and APIs. Some package indexes, OAuth 1.0 signatures (HMAC-SHA1) and legacy file formats still use it.

Collision Risk in Practice

A collision attack lets someone who controls both inputs produce two files with the same SHA-1. That breaks signatures and certificates, where an attacker can get one document signed and swap in the other. It does not affect cases where you only need to detect accidental changes, and it does not let anyone reverse a hash. Git added collision detection after SHAttered, so known attack files are rejected. For anything new that needs collision resistance, use SHA-256.

Reversing SHA-1

There is no way to turn a SHA-1 back into its input. Short or common inputs can be found by guessing, which is how millions of unsalted SHA-1 passwords from the 2012 LinkedIn breach were cracked within days. Passwords belong in bcrypt, scrypt or Argon2. If you need to read a value back later, encode it with Base64 or encrypt it instead of hashing.

Related Tools

Frequently Asked Questions

How long is a SHA-1 hash?
160 bits, shown as 40 hex characters. The SHA-1 of "hello" is aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d.
Is SHA-1 still secure?
Not for signatures or anything an attacker can influence. The SHAttered attack produced two different PDFs with the same SHA-1 in 2017, and a cheaper chosen-prefix collision followed in 2020. Browsers stopped trusting SHA-1 certificates in 2017. For new work use SHA-256.
Why doesn't hashing a file's text give me its Git commit or blob ID?
Git hashes a header plus the content, not the content alone. A blob ID is the SHA-1 of the word blob, a space, the size in bytes, a null byte and then the content, so a file containing hello and a newline has ID ce013625030ba8dba906f756967f9e9ca394464a, not the plain SHA-1 of the text. Use git hash-object file to get it.
Is HMAC-SHA1 broken too?
No. HMAC's security does not depend on collision resistance, so HMAC-SHA1 is still considered safe. It is the default in TOTP (RFC 6238), which is why most authenticator apps still use it. You can compute one with the HMAC generator.
Can I decrypt a SHA-1 hash?
No. SHA-1 is not encryption and the input is not stored in the digest. "SHA-1 decrypt" sites only match hashes of strings they have already seen, such as common passwords. The collision attacks do not help either: they build two new inputs with the same hash, they do not recover the input behind an existing one.