b2KIT

SHA-1 Hash Generator

Compute SHA-1 hash values from text or files entirely in the browser using the WebCrypto API.

Tested tool guide Tested browser tools Checked August 16, 2026

What SHA-1 Hash Generator does, with a checked example

Paste text or drop a file, and this tool returns the SHA-1 digest: a fixed 40-character hexadecimal string that fingerprints those exact bytes. Everything runs locally through the browser's WebCrypto API, so the content never leaves the machine. The surprise for most users is that SHA-1 is cryptographically broken: since 2017 an attacker can craft two different files with the same hash, so it is fine for casual checksums and deduplication but not for protecting anything against tampering. The result is always 40 hex characters, and any change, even a trailing space, scrambles it completely.

Worked example

A concrete input and expected output from the current implementation.

Input

abc

Expected output

a9993e364706816aba3e25717850c26c9cd0d89d

SHA-1 of the three bytes 'abc' is the canonical test vector published in RFC 3174 and FIPS 180-1. Any conforming implementation must produce exactly this 40-character digest, so it also works as a self-check that the tool is wired up correctly.

How the result is produced

1

Bytes, not characters

The hash is computed over bytes, so pasted text is first encoded as UTF-8; the same words in UTF-16 or legacy Latin-1 produce a different digest. Whitespace counts: a trailing newline, CRLF instead of LF, or an invisible character all change the result. For files, the raw bytes are hashed as-is, so the file must be byte-for-byte identical to whatever reference hash you compare against.

2

Local computation and output

Digests are produced in the page via crypto.subtle.digest('SHA-1', data), part of the standard WebCrypto API, which browsers expose only in secure contexts (HTTPS or localhost); opened from a plain http:// address elsewhere, the API is unavailable. Files are read into memory and hashed in place, nothing is uploaded. The result is the 160-bit value written as 40 hexadecimal characters.

Good uses

  • Verifying a downloaded file against a published SHA-1 checksum: legacy mirrors, firmware sites, and archives still list SHA-1 sums, so you drop the file in and compare the 40-character digest to the one printed on the page.
  • Proving two files are byte-for-byte identical without opening them: after copying, exporting, or transferring a file, a matching hash confirms nothing changed, and it is a quick way to spot duplicate backups before deleting one.
  • Producing a stable content-derived identifier in non-adversarial systems: git names objects by SHA-1, and you can do the same to tag records or assets with a hash that changes whenever the content changes.

Limits and checks

  • Collision-broken since 2017: the SHAttered team published two different files with the same SHA-1, and cheaper attacks have followed. Never use it where an adversary can influence either input, such as download integrity against tampering, signatures, or certificates. It survives only as a non-adversarial checksum.
  • It hashes bytes, not meaning: a trailing newline, CRLF instead of LF, a BOM, or a different text encoding yields a different digest. A mismatch with a reference usually means the bytes differ, so check invisible characters before suspecting the tool.
  • Formatting traps: the output is a 40-character hex string, and uppercase versus lowercase are the same value, so do not treat case differences as mismatches. A 64-character hex string is SHA-256, not SHA-1, and comparing across algorithms always fails.

Common questions

Is SHA-1 still safe to use?

Not for anything security-sensitive. Collision attacks became practical in 2017 (the SHAttered project produced two different PDFs with the same SHA-1), and NIST has since retired SHA-1 for federal use. It remains acceptable as a non-adversarial checksum, for deduplication, and for reading git's SHA-1 object names, but use SHA-256 or SHA-3 for anything an attacker could influence.

Why doesn't my hash match the one from shasum or the download page?

Almost always because the bytes differ: a trailing newline, CRLF versus LF line endings, a UTF-8 BOM, or a differently encoded string all change the digest. Paste the exact same characters or hash the exact same file, and confirm both sides are actually SHA-1: SHA-256 digests are 64 hex characters, not 40.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools