class documentation

Object format (hash algorithm) used in Git.

Method __init__ Initialize an object format.
Method __repr__ Return repr.
Method __str__ Return string representation.
Method hash_object Hash data and return the digest.
Method hash_object_hex Hash data and return the hexadecimal digest.
Method new_hash Create a new hash object.
Instance Variable hash_func Undocumented
Instance Variable hex_length Undocumented
Instance Variable name Undocumented
Instance Variable oid_length Undocumented
Instance Variable type_num Undocumented
def __init__(self, name: str, type_num: int, oid_length: int, hex_length: int, hash_func: Callable[[], HASH]):

Initialize an object format.

Parameters
name:strName of the format (e.g., "sha1", "sha256")
type_num:intFormat type number used in Git
oid_length:intLength of the binary object ID in bytes
hex_length:intLength of the hexadecimal object ID in characters
hash_func:Callable[[], HASH]Hash function from hashlib
def __repr__(self) -> str:

Return repr.

def __str__(self) -> str:

Return string representation.

def hash_object(self, data: bytes) -> bytes:

Hash data and return the digest.

Parameters
data:bytesData to hash
Returns
bytesBinary digest
def hash_object_hex(self, data: bytes) -> bytes:

Hash data and return the hexadecimal digest.

Parameters
data:bytesData to hash
Returns
bytesHexadecimal digest as bytes
def new_hash(self) -> HASH:

Create a new hash object.

hash_func =

Undocumented

hex_length =

Undocumented

name =

Undocumented

oid_length =

Undocumented

type_num =

Undocumented