Skip to main content

hash_object

Function hash_object 

Source
pub fn hash_object(
    format: ObjectFormat,
    type_name: &str,
    payload: &[u8],
) -> Result<Digest, HashError>
Expand description

Hash uncompressed Git object bytes: type SP size NUL + payload.

type_name is the ASCII type token (blob, tree, commit, tag). payload is the raw object body (not zlib-wrapped).

Refuses with HashError::Sha1Collision when a cryptanalytic SHA-1 collision attack is detected in the hashed stream (OBJ-004 Claimed detect).