hmac
Module for SHA-2 algorithms.
- class HmacSha256
Bases:
object
HMAC-SHA256 class. It computes digests using HMAC-SHA256 algorithm.
- static QuickDigest(key: Union[bytes, str], data: Union[bytes, str]) bytes
Compute the digest (quick version).
- Parameters:
key (str or bytes) – Key
data (str or bytes) – Data
- Returns:
Computed digest
- Return type:
bytes
- static DigestSize() int
Get the digest size in bytes.
- Returns:
Digest size in bytes
- Return type:
int
- class HmacSha512
Bases:
object
HMAC-SHA512 class. It computes digests using HMAC-SHA512 algorithm.
- static QuickDigest(key: Union[bytes, str], data: Union[bytes, str]) bytes
Compute the digest (quick version).
- Parameters:
key (str or bytes) – Key
data (str or bytes) – Data
- Returns:
Computed digest
- Return type:
bytes
- static QuickDigestHalves(key: Union[bytes, str], data: Union[bytes, str]) Tuple[bytes, bytes]
Compute the digest and return it split into two halves (quick version).
- Parameters:
key (str or bytes) – Key
data (str or bytes) – Data
- Returns:
Computed digest left part (index 0) and right part (index 1)
- Return type:
tuple[bytes, bytes]
- static DigestSize() int
Get the digest size in bytes.
- Returns:
Digest size in bytes
- Return type:
int