Skip to main content

Module sha256

Module sha256 

Source
Expand description

Batched SHA-256 leaf hashing and inner-node compression.

A round cannot start until the one before it lands, so a single chain stalls on itself. Both paths here hash many independent messages per call, which fills those stalls.

The portable submodule holds the multi-lane kernel every batched path runs on. The architecture-specific kernels it dispatches to are private submodules:

    avx512   x86-64, sixteen lanes held transposed across 512-bit registers
    sha_ni   x86-64, independent chains interleaved over the SHA extension
    neon     aarch64, the same over the ARMv8 crypto extension

Each is compiled in only when the target has the feature. Each is also pinned equal to the portable path by its tests.

The spec constants live here, since every kernel reads them.

Reference: FIPS 180-4, section 6.2.

Modules§

portable
Portable, auto-vectorized SHA-256 multi-lane kernel.

Structs§

ParallelSha256Compression
Parallel SHA-256 two-to-one compression for the inner nodes of a Merkle tree.
ParallelSha256Digest
Batches fixed-length SHA-256 leaves through the multi-lane kernel.