Contact

Tools  /  Security  /  SHA-1 Hash Generator

SHA-1 Hash Generator

SHA-1 with a live Git object-hash mode (matches git hash-object exactly), an HMAC-SHA1/TOTP demo showing where SHA-1 is still genuinely valid, and the SHAttered collision story explaining where it is not.

What this tool does

Computes SHA-1 from text or a file, a Git object hash mode that reproduces exactly what git hash-object outputs for the same content, a live HMAC-SHA1 / TOTP (RFC 6238) demo, and a self-check against the official standard test vectors. This is a focused, SHA-1-specific companion to this site's general Hash Generator -- here for the two things that make SHA-1 different from every other broken hash: it is still load-bearing inside Git's object model, and its *keyed* variant (HMAC-SHA1) is still genuinely fine for things like one-time codes, while raw unkeyed SHA-1 is not.

The SHAttered attack (2017)

On February 23, 2017, researchers at Google and CWI Amsterdam published the first practical SHA-1 collision, nicknamed SHAttered. They produced two different PDF files with completely different visible content that hash to the exact same SHA-1 digest -- proof the collision resistance that makes a hash trustworthy for signatures and certificates was gone in practice, not just in theory. The attack took roughly 9,223,372,036,854,775,808 SHA-1 computations (about 6,500 CPU-years plus a GPU phase), which sounds enormous but was already within reach of a well-funded attacker -- and far cheaper than anyone expected when NIST first flagged SHA-1's theoretical weakness back in 2005.

Why SHA-1 was retired for security

NIST deprecated SHA-1 in 2011 and formally disallowed it for digital signatures at the end of 2013, based on theoretical attacks that made collisions cheaper than the 2^80 operations a 160-bit hash should require. The CA/Browser Forum banned issuing new SHA-1 TLS certificates starting January 1, 2016, and major browsers stopped trusting SHA-1 certificates entirely by 2017 -- all before SHAttered even landed, which simply confirmed the deprecation had been the right call. NIST's own roadmap retires every remaining SHA-1 usage from federal specifications by the end of 2030.

Git still uses SHA-1 -- and that's a different risk model

Every Git commit, tree, and blob is identified by a SHA-1 hash of its contents, and that hasn't changed just because SHA-1 is broken for signatures. The reason it's a different problem: Git's SHA-1 usage is a content-addressing and accidental-corruption check, not a defense against a motivated adversary engineering a matching object on purpose -- and since SHAttered, Git has shipped SHA-1DC (collision-detecting SHA-1), which actively detects the specific structure SHAttered- style attacks rely on and refuses to hash a deliberately crafted collision. Git's long-term fix is a full transition to SHA-256 object IDs, which is still in progress across the ecosystem. The "Git Object Hash" mode on this page reproduces the exact value git hash-object would output for the same content, by hashing "blob " + length + "\0" + content rather than the raw content alone.

HMAC-SHA1 and TOTP are still genuinely fine

This is the detail most "SHA-1 is dead" explainers skip: HMAC-SHA1 doesn't inherit SHA-1's collision weakness, because HMAC's security doesn't depend on collision resistance the way raw hashing (for signatures) does -- it depends on SHA-1 still behaving like a pseudorandom function under a secret key, which it does. That's exactly why TOTP, RFC 6238 (the algorithm behind most 6-digit authenticator-app codes) still specifies HMAC-SHA1 as its default, over a decade after SHA-1 signing was banned. The TOTP demo on this page computes a real code from a secret and the current time using the exact RFC 6238 construction, so you can see HMAC-SHA1 actually at work in a system still considered secure today.

Self-check against RFC 3174 and RFC 2202

RFC 3174 publishes the official SHA-1 test vectors and RFC 2202 publishes the official HMAC-SHA1 test vectors -- this tool computes all of them live, using the browser's native Web Crypto implementation, and checks the result against the published values so the implementation is demonstrated correct rather than just asserted.

Privacy

Everything is computed entirely in your browser via the native Web Crypto API. Nothing you type, upload, or generate here is sent to a server.

Frequently asked questions

Is SHA-1 safe to use for anything?
Not for digital signatures, certificates, or anything where an attacker could deliberately engineer a matching hash -- the SHAttered attack (2017) proved practical collisions are achievable. It remains fine for non-adversarial integrity checks, and its keyed variant HMAC-SHA1 is still genuinely secure for things like TOTP one-time codes, because HMAC does not depend on the same collision resistance that raw signing does.
Why does Git still use SHA-1 if it is broken?
Git uses SHA-1 as a content-addressing scheme and corruption check, not as a defense against a deliberate forgery -- a different threat model than signing. Since SHAttered, Git ships SHA-1DC, a collision-detecting variant that recognizes and rejects the specific structure SHAttered-style attacks rely on. A full move to SHA-256 object IDs is underway but not yet complete across the Git ecosystem.
What is the "Git Object Hash" mode computing?
The exact value git hash-object outputs for a blob: SHA-1 of the string "blob " followed by the content's byte length, a null byte, then the content itself -- not a hash of the raw content alone. This matches real Git output byte-for-byte for the same bytes.
Is HMAC-SHA1 also broken?
No -- HMAC-SHA1's security relies on SHA-1 behaving as a pseudorandom function under a secret key, which is unaffected by the collision attacks that broke unkeyed SHA-1 for signatures. This is exactly why RFC 6238 (TOTP, the algorithm behind most authenticator-app codes) still specifies HMAC-SHA1 as its default today.
What was the SHAttered attack?
Published February 23, 2017 by Google and CWI Amsterdam, it was the first practical SHA-1 collision: two different PDFs engineered to produce the exact same SHA-1 digest. It cost roughly 6,500 CPU-years plus a GPU phase -- expensive, but conclusively within reach of a real attacker, confirming the deprecation that CAs and browsers had already started acting on since 2016.
When is SHA-1 actually being fully retired?
NIST disallowed it for digital signatures at the end of 2013, the CA/Browser Forum banned new SHA-1 TLS certificates from January 1, 2016, and browsers stopped trusting SHA-1 certificates by 2017. NIST's own specifications are set to drop all remaining SHA-1 usage by the end of 2030.
How is this different from the main Hash Generator?
The main Hash Generator covers nine algorithms side by side for quick comparison. This tool goes deep on SHA-1 specifically: the Git object-hash format, a live HMAC-SHA1/TOTP demo, and the SHAttered collision history and timeline -- depth on one algorithm rather than breadth across several.
Is anything I hash or generate here sent anywhere?
No. Every computation runs entirely in your browser using the native Web Crypto API -- this tool has no server component.
Theme Accent