ZXFoundation™ 26h2
Loading...
Searching...
No Matches
crypto.sha256.core Module Reference

Data Structures

struct  crypto::sha256::sha256_ctx
 SHA-256 running computation context. More...

Functions

auto crypto::sha256::sha256_final (sha256_ctx &ctx, std::span< u8, SHA256_DIGEST_SIZE > out) -> std::expected< void, lib::kernel_error >
 Finalize the hash and write the 32-byte digest.
auto crypto::sha256::sha256_hash (std::span< const u8 > data, std::span< u8, SHA256_DIGEST_SIZE > out) -> std::expected< void, lib::kernel_error >
 One-shot SHA-256: hash data and write the 32-byte digest to out.
auto crypto::sha256::sha256_init (sha256_ctx &ctx) -> void
 Initialize a SHA-256 context to the FIPS 180-4 initial hash value.
auto crypto::sha256::sha256_update (sha256_ctx &ctx, std::span< const u8 > data) -> std::expected< void, lib::kernel_error >
 Feed a span of bytes into a running SHA-256 computation.
auto crypto::sha256::sha256_verify (std::span< const u8 > data, std::span< const u8, SHA256_DIGEST_SIZE > expected) -> std::expected< void, lib::kernel_error >

Variables

u64 bit_count {}
 Total message bits processed so far.
u8 buf [64] {}
 Partial-block accumulation buffer.
u32 buf_len {}
 Number of valid bytes in buf (0..63).
bool finalized {}
 Set by sha256_final(); guards against double-finalize.
constexpr auto crypto::sha256::SHA256_DIGEST_SIZE = 32U
 Byte length of a SHA-256 message digest.
u32 state [8] {}
 Current intermediate hash values (H0..H7).

Files

file  crypto/sha256.zcomponent/core.cxxm
file  crypto/sha256.zcomponent/core.cxx