std1.0.0-beta-7 SafeC docs

Module crypto::digest

#include <std/crypto/digest.h> source

hash algorithms chosen at run time.

Signature schemes name their hash in data (an X.509 AlgorithmIdentifier, a TLS SignatureScheme), so the verifiers in rsa.h / ec.h / x509.h take a DIGEST_* id rather than a generic hash type. digest() hashes with the algorithm an id names; DigestCtx streams. For code that knows its hash at compile time, hash.h's Hasher generics remain the direct route.

Structs

DigestCtxA streaming hash of any DIGEST_* algorithm.

Functions

digest_sizeThe digest length of 'alg' in bytes (0 for an unknown id).
digestHash data[0..len) with 'alg' into 'out' (digest_size(alg) bytes). Returns the digest length, 0 for an unknown id.
mgf1_xorMGF1 (RFC 8017 §B.2.1) with 'alg': XORs the mask generated from seed[0..seed_len) into data[0..len).

Macros

DIGEST_NONE
DIGEST_SHA1
DIGEST_SHA224
DIGEST_SHA256
DIGEST_SHA384
DIGEST_SHA512
DIGEST_MAX_SIZE