Skip to main content

hash_object

Function hash_object 

Source
pub fn hash_object(
    algo: HashAlgo,
    kind: ObjectKind,
    data: &[u8],
) -> Result<ObjectId>
Expand description

Hash canonical Git store bytes for kind and data.

Equivalent to HashAlgo::hash_object but accepts the algorithm as the first argument.

Detection runs over the bytes that form the object id (header and payload), as in Git. A payload that only collides when hashed on its own, such as the SHAttered PDFs stored as blobs in Git’s own history, is an ordinary object.

§Errors

Returns Error::HashCollision when sha1dc detects a chosen-prefix collision.