Skip to main content

Module sha256_x4

Module sha256_x4 

Source
Expand description

Four-way interleaved SHA-256 over the ARMv8 crypto extension.

The SHA unit is pipelined, so one dependent hash chain leaves it under-full. Interleaving four independent hashes fills the pipeline and raises throughput.

The target is bulk Merkle leaf hashing, where the leaves of a level are independent. The sha2 crate hashes one stream at a time, so that headroom goes unused.

The output equals [sha2::Sha256] byte for byte, pinned by the proptests below. Off aarch64, or without the sha2 feature, it falls back to four sha2 hashes.

Functions§

compress256_x4
Compresses one 64-byte block into each of four independent SHA-256 states, in place.
sha256_x4
Hashes four equal-length byte inputs into four standard SHA-256 digests.

Type Aliases§

Hash
A SHA-256 digest.