Typing Protocols

class multihash.HasherType(*args, **kwargs)

Protocol for “hashers”.

These are classes that actually compute the hashes.

block_size: int
copy()

Produce a copy of the hasher.

Return type

HasherType

digest()

Produce a digest.

Return type

bytes

digest_size: int
hexdigest()

Produce a hexdigest.

Return type

str

name: str
update(data)

Update the hasher.

Return type

None

class multihash.HasherFactory(*args, **kwargs)

Protocol for “hasher factories”.

These are objects/functions that return instances that implement HasherType when called, eg: hashlib.md5.

__call__(data=b'')

Return a hasher.

Return type

HasherType