crypto_hash

class CryptoHash
static default()

Build a new CryptoHash using the Rust Default trait.

Returns:

CryptoHash

static from_bytes(data)

Deserialize from bytes.

Parameters:

data (bytes) – the serialized object.

Returns: the deserialized object.

static from_json(raw)

Build from a JSON string.

static from_str(s)

Parse from a string.

s (str): The string to parse

Returns:

CryptoHash

static hash_bytes(data)

Calculates hash of given bytes.

to_json()

Convert to a JSON string.

static zero()

Initialize a CryptoHash as 32 * 0 bytes.

crypto_hash(data)

Calculates a hash of a bytes slice.

The example below calculates the hash of the indicated data.

Example

>>> from pyonear.crypto_hash import crypto_hash
>>> crypto_hash(bytes([1, 2, 3]))
CryptoHash(
    `EutHBsdT1YCzHxjCfQHnLPL1vFrkSyLSio4vkphfnEk`,
)