Hash functions

SHA-1dc

The 160-bit NIST hash with practical collisions since 2017; kept for compatibility

unverified Root API only
Unverified tier.

Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.

About SHA-1dc

SHA-1dc 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. NextSSL lists it in the unverified 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–2022
  1. SHA-1 published in FIPS 180-1

  2. Wang, Yin and Yu find a theoretical collision attack

  3. Specified in FIPS 180-4

  4. SHAttered: first public SHA-1 collision

  5. Chosen-prefix collision demonstrated (SHA-1 is a Shambles)

  6. 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

Verifying legacy signatures and checksumsGit object IDs (collision-detecting variant)HMAC-SHA1 in older protocols such as TOTP

Sizes

FieldBytesMeaning
out20Output

Use it

from nextssl_demo import NextSSL

root = NextSSL(root=True)   # tier 'unverified' is reachable from the root API only
digest = root.call("hash_with", "sha-1dc", None, b"abc")[0]

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

2

Frequently asked questions

What is SHA-1dc?

SHA-1dc 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-1dc sizes?

In NextSSL, SHA-1dc uses: output 20 bytes.

Who designed SHA-1dc and when?

SHA-1dc 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).

Is SHA-1dc safe to use?

SHA-1dc is in the unverified tier. Source found and wired, correctness not fully proven. Root API 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 sha0, sha1 in the SHA-1 and SHA-0 family.