Crypto

bip38.crypto.ripemd160(data: str | bytes) bytes

Calculate the RIPEMD-160 hash of the given data.

Parameters:

data (Union[str, bytes]) – The data to hash, as bytes or a string.

Returns:

The RIPEMD-160 hash digest as bytes.

Return type:

bytes

bip38.crypto.sha256(data: str | bytes) bytes

Calculate the SHA-256 hash of the given data.

Parameters:

data (Union[str, bytes]) – The data to hash, as bytes or a string.

Returns:

The SHA-256 hash digest as bytes.

Return type:

bytes

bip38.crypto.double_sha256(data: str | bytes) bytes

Calculate the double SHA-256 hash of the given data.

Parameters:

data (Union[str, bytes]) – The data to hash, as bytes or a string.

Returns:

The double SHA-256 hash digest as bytes.

Return type:

bytes

bip38.crypto.get_checksum(data: str | bytes) bytes

Calculate the checksum for the given raw bytes.

The checksum is derived by performing a double SHA-256 hash on the input and returning the first few bytes, as determined by CHECKSUM_BYTE_LENGTH.

Parameters:

data (Union[str, bytes]) – The raw data to checksum.

Returns:

The checksum of the data.

Return type:

bytes

bip38.crypto.hash160(data: str | bytes) bytes

Calculate the HASH160 hash (RIPEMD-160 of SHA-256) of the given data.

Parameters:

data (Union[str, bytes]) – The data to hash, as bytes or a string.

Returns:

The HASH160 hash digest as bytes.

Return type:

bytes