The Digest service: layer_web_crypto and native build it,
and DigestService(digest=..., digest_hex=...) makes one of two
functions.
Functions#
__init__#
__init__(*, digest, digest_hex) -> None| Parameter | Type | Description |
|---|---|---|
digest | Callable[[Algorithm, Binary], Effect[bytes]] | |
digest_hex | Callable[[Algorithm, Binary], Effect[str]] |
def __init__(
self,
*,
digest: Callable[[Algorithm, Binary], Effect[bytes]],
digest_hex: Callable[[Algorithm, Binary], Effect[str]],
) -> None:
self._digest = digest
self._digest_hex = digest_hexdigest#
digest(algorithm, data) -> Effect[bytes]algorithm's digest of data.
| Parameter | Type | Description |
|---|---|---|
algorithm | Algorithm | |
data | Binary |
Returns Effect[bytes]
def digest(self, algorithm: Algorithm, data: Binary) -> Effect[bytes]:
"""``algorithm``'s digest of ``data``."""
return self._digest(algorithm, data)digest_hex#
digest_hex(algorithm, data) -> Effect[str]algorithm's digest of data, as lowercase hex.
| Parameter | Type | Description |
|---|---|---|
algorithm | Algorithm | |
data | Binary |
Returns Effect[str]
def digest_hex(self, algorithm: Algorithm, data: Binary) -> Effect[str]:
"""``algorithm``'s digest of ``data``, as lowercase hex."""
return self._digest_hex(algorithm, data)