SHA-1
The 160-bit NIST hash with practical collisions since 2017; kept for compatibility
Practical attacks exist. Present for compatibility and research only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About SHA-1
SHA-1 is one of 3 SHA-1 and SHA-0 variants in the NextSSL registry, a cryptographic hash function. It produces a 20-byte (160-bit) output. Its registry entry cites FIPS 180-4 and RFC 3174. NextSSL lists it in the broken tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
SHA-1 is a 160-bit Merkle–Damgård hash published by NIST in 1995 as a fix to the withdrawn SHA-0. It was the dominant hash of the 2000s, but practical collisions and chosen-prefix collisions have since been demonstrated, and it must not be used where collision resistance matters.
SHA-1 processes 512-bit blocks through 80 rounds on a 160-bit state of five 32-bit words, in the same design lineage as MD4 and MD5. SHA-0, published in 1993 and withdrawn shortly afterwards, differs only by a missing one-bit rotation in the message expansion; that small change made SHA-0 far weaker and was the reason SHA-1 was issued.
NextSSL carries SHA-1, SHA-0 and SHA-1DC. SHA-1DC is the collision-detecting variant by Marc Stevens and Dan Shumow: it computes standard SHA-1 but flags inputs that show the disturbance patterns used by known collision attacks, and is the implementation Git adopted after the SHAttered collision. The output for ordinary inputs is identical to SHA-1.
History
1995–2022SHA-1 published in FIPS 180-1
Wang, Yin and Yu find a theoretical collision attack
Specified in FIPS 180-4
SHAttered: first public SHA-1 collision
Chosen-prefix collision demonstrated (SHA-1 is a Shambles)
NIST announces SHA-1 retirement by 2030
Security notes
SHA-1 is broken for collision resistance: the SHAttered attack produced a full collision in 2017 and a practical chosen-prefix collision followed in 2020. SHA-0 is broken more severely. Preimage resistance is still not practically broken, so HMAC-SHA1 and legacy protocol uses survive, but new designs should use SHA-2 or SHA-3.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| out | 20 | Output |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'broken' is reachable from the root API only
digest = root.call("hash_with", "sha1", None, b"abc")[0]
nextssl_root_hash_with("sha1", NULL, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let digest = reg::hash_in(reg::all(), Policy::Any, "sha1", &Params::new(), b"abc")?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other SHA-1 and SHA-0 variants
2Similar names
Looking for something else?More hash functions
All 424Frequently asked questions
What is SHA-1?
SHA-1 is a hash in the SHA-1 and SHA-0 family. SHA-1 is a 160-bit Merkle–Damgård hash published by NIST in 1995 as a fix to the withdrawn SHA-0.
What are the SHA-1 sizes?
In NextSSL, SHA-1 uses: output 20 bytes.
Who designed SHA-1 and when?
SHA-1 belongs to the SHA-1 and SHA-0 family, first published in 1995 by National Security Agency. Its origin: NIST FIPS 180-1 (now FIPS 180-4).
Which standards define SHA-1?
SHA-1 is referenced by FIPS 180-4, RFC 3174. It is specified in a FIPS standard.
Is SHA-1 safe to use?
SHA-1 is in the broken tier. Practical attacks exist. Present for compatibility and research only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other SHA-1 and SHA-0 variants are there?
NextSSL also registers sha-1dc, sha0 in the SHA-1 and SHA-0 family.
Related families
NIST SP 800-90A deterministic random bit generator built on HMAC
MD2, MD4 and MD5Ron Rivest's message-digest hashes; all three are broken and kept for legacy use
SHA-2The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software
SHA-3 and KeccakThe Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2
HMACThe standard way to build a MAC from a cryptographic hash (RFC 2104, FIPS 198-1)
SHA-3 and KeccakThe Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2