Skip to main content

Module integrity

Module integrity 

Source
Expand description

Content integrity verification via SHA-256.

Provides streaming hash computation for files and in-memory data, plus constant-time hash comparison for verification.

Structs§

StreamingHasher
Streaming hash verifier for chunked data reception.

Constants§

HASH_HEX_LEN
Size of a SHA-256 hex string.
HASH_LEN
Size of a SHA-256 hash in bytes.

Functions§

hash_bytes
Compute the SHA-256 hash of an in-memory byte slice as a hex string.
hash_bytes_raw
Compute the raw SHA-256 hash of an in-memory byte slice.
hash_file
Compute the SHA-256 hash of a file as a hex string.
hash_reader
Compute the SHA-256 hash of data from any reader as a hex string.
verify_file_hash
Verify that a file’s hash matches an expected hex string.
verify_hash
Verify that a byte slice’s hash matches an expected hex string.