Skip to Content
oxcrypto
HashesLegacy compatibility

Collision-checked SHA-1

SHA-1 digest algorithms with collision detection.

SHA-1 is cryptographically broken. Available for legacy compatibility.

try_digest and try_digest_chunks return a CollisionResult with digest, status, and has_collision.

Example

from oxcrypto.hash.sha1_checked import SHA1_CHECKED

algorithm = SHA1_CHECKED.SHA1_CHECKED
digest = algorithm.digest(b"hello")
assert digest == algorithm.digest_chunks([b"he", b"llo"])

hasher = algorithm.new()
hasher.update(b"he")
hasher.update(b"llo")
assert hasher.digest() == digest
print(digest.hex())

result = algorithm.try_digest(b"hello")
assert result.status == 'ok'
assert result.digest == digest

Variants

  • SHA1_CHECKED.SHA1_CHECKED

Methods

digest(self, data: bytes, /) -> bytes
digest_chunks(self, chunks: Iterable[bytes], /) -> bytes
new(self) -> Hasher
try_digest(self, data: bytes, /) -> CollisionResult
try_digest_chunks(self, chunks: Iterable[bytes], /) -> CollisionResult

On this page