Skip to main content

Module hash

Module hash 

Source
Expand description

Object-id hashing, file checksums, and hash algorithm selection.

Re-exports§

pub use parallel::hash_objects_parallel;
pub use parallel::index_parallelism_from_config;
pub use parallel::par_hash_with;
pub use parallel::parallel_hash_worthwhile;
pub use parallel::try_par_hash_with;
pub use parallel::try_par_hash_with_force;
pub use parallel::ParallelHashError;
pub use parallel::Parallelism;
pub use parallel::PAR_HASH_MIN_ITEMS;
pub use parallel::PAR_HASH_MIN_TOTAL_BYTES;

Structs§

HashingWriter
A writer that forwards bytes to an inner sink while accumulating a checksum.
ObjectPayloadHasher
Incremental Git object-id hash (header plus payload chunks).
TrailerMismatch
Checksum at the end of bytes did not match a digest of the leading body.

Enums§

Backend
Which implementation the sha1 / sha2 dependency selects for algo on this CPU.
ChecksumHasher
Incremental hasher for Git file checksums (pack/index/MIDX/commit-graph trailers).
ObjectHasher
Incremental hasher for Git’s supported object-id algorithms.

Constants§

PAR_HASH_MIN_ITEMS
Minimum item count before parallel helpers use more than one thread.
PAR_HASH_MIN_TOTAL_BYTES
Minimum total payload bytes (summed over items) for parallel hashing.

Functions§

backend
Report the hashing backend used for object-id digests on this CPU.
hash_object
Hash canonical Git store bytes for kind and data.
hash_objects_parallel
Hash Git objects in parallel, preserving input order.
par_hash_with
Run f over items with up to threads workers, preserving order.
parallel_hash_worthwhile
Returns true when parallel hashing is expected to beat a serial loop.
try_par_hash_with
Fallible variant of par_hash_with.
try_par_hash_with_force
Like try_par_hash_with, but ignores batch thresholds.
verify_trailer
Verify that bytes ends with the hash of the preceding body.