Skip to main content

python-sha1dc

Python bindings for the Rust sha1dc crate: SHA-1 with collision detection.

The API mirrors hashlib.sha1. Methods that produce a digest raise Sha1CollisionError when a SHA-1 collision attack is detected in the input, so a caller that treats the digest as an identity does not accept the attacker's forged value.

Usage

import sha1dc

h = sha1dc.sha1(b"hello ")
h.update(b"world")
print(h.hexdigest())
# 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed

try:
    sha1dc.digest(open("shattered-1.pdf", "rb").read())
except sha1dc.Sha1CollisionError as exc:
    forged_digest, forged_hex = exc.args
    print("refusing colliding digest:", forged_hex)

A mitigate variant is also available for cases where you must still produce a usable, non-standard digest from attacking input; see sha1dc.mitigate.

Building

pip install maturin
maturin develop --release

License

Apache-2.0

Metadata

Release files for sha1dc 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sha1dc 0.1.0
File Size Uploaded Provenance Actions
sha1dc-0.1.0.tar.gz 6.8 kB Without provenance Details for sha1dc-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sha1dc 0.1.0
File Interpreter ABI Platform Actions
sha1dc-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl CPython 3.11 abi3 Linux glibc 2.34+ x86-64 Details for sha1dc-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl

Total release size: 305.6 kB

Release files / sha1dc-0.1.0.tar.gz

Download URL sha1dc-0.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
687a635f342ddcbd792be8febb433dd2ac14bfb33371f0736bc1543643f343c5
BLAKE2b-256 checksum
How to use checksums
c89792036e3064ee8f7775ac7fcf430e5b3b55b84180aa1718c6e7d953a653c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / sha1dc-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl

Download URL sha1dc-0.1.0-cp311-abi3-manylinux_2_34_x86_64.whl
Size 298.8 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
d1b2aaa15af9eced48509508c08c6450590161f1a2c48ce79922a85aa926fe23
BLAKE2b-256 checksum
How to use checksums
5d9e86e58ede876b2391c612af524e15a787174097304e24855e538271deba93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for sha1dc 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page