Expand description
RHDL SHA-256 compression implementations and performance-lane building blocks.
This crate is the hash foundation for the separately typed
HASHSIGS_SHA256_GENERIC_V1 profile. It is deliberately incompatible with
the legacy Keccak profile.
The correctness path consists of:
- allocation-free, compile-time-capable SHA-256 primitives and compression;
- a byte-oriented padding/block-stream helper;
- an RHDL round kernel whose token carries the eight working words and a sixteen-word rolling message-schedule window;
- an RHDL combinational compression kernel used as a lowering oracle; and
- a resetless round-pipeline foundation with separately reset valid bits; and
lane::CompressionLane, which aligns the original chaining value in a circular synchronous memory and performs feed-forward; andfarm::ThreeLaneCompressionFarm, a standalone generation and equivalence target with independent inputs, outputs, tags, and valid streams.
The production WOTS signer does not embed that farm. It uses three autonomous four-context clusters, with one complete compression lane owned by each cluster.
Modules§
- farm
- Parallel compression-lane farm for the performance profile. Parallel SHA-256 compression lanes for the performance profile.
- lane
- Complete streaming compression-lane implementation. Complete, one-block-per-cycle SHA-256 compression lane.
Structs§
- Pipeline
Word - Pipeline payload.
stateis meaningful only whilevalidis true. - Round
Pipeline - A resetless, fully registered prefix of the 64-round SHA-256 pipeline.
- Round
State - Complete 768-bit datapath token for one SHA-256 round.
- Working
State - Eight SHA-256 working variables carried by every round token.
Constants§
- BLOCKS_
FOR_ 32_ BYTES - Padded block count for a 32-byte hash input.
- BLOCKS_
FOR_ 35_ BYTES - Padded block count for a 35-byte
HashSigsPRF input. - BLOCKS_
FOR_ 64_ BYTES - Padded block count for a 64-byte secret-segment input.
- BLOCKS_
FOR_ 2144_ BYTES - Padded block count for the 2,144-byte concatenated public-key segments.
- BLOCK_
BYTES - SHA-256 compression-block size in bytes.
- DIGEST_
BYTES - SHA-256 digest size in bytes.
- INITIAL_
STATE - SHA-256 initial chaining value from FIPS 180-4 section 5.3.3.
- LANE_
DATAPATH_ FFS - Resetless datapath-register count in one complete 64-round lane.
- LANE_
PIPELINE_ FFS - Total round-pipeline registers in one lane, excluding chaining-value memory.
- LANE_
TAG_ FFS - Resetless tag-register count in one complete lane.
- LANE_
VALID_ FFS - Resettable valid-register count in one complete lane.
- ROUND_
CONSTANTS - The 64 SHA-256 round constants from FIPS 180-4 section 4.2.2.
- ROUND_
CONSTANTS_ RHDL - RHDL-width-preserving form of
ROUND_CONSTANTS. - ROUND_
COUNT - Number of rounds in one SHA-256 compression operation.
- ROUND_
TOKEN_ BITS - Number of bits in one resetless round-pipeline token.
- SCHEDULER_
TAG_ BITS - Width of the opaque scheduler tag carried beside every pipeline token.
- THREE_
LANE_ DATAPATH_ FFS - Provisional resetless datapath-register count in three complete lanes.
- THREE_
LANE_ PIPELINE_ FFS - Total round-pipeline registers projected for three lanes.
Functions§
- big_
sigma_ one - SHA-256 uppercase sigma one.
- big_
sigma_ one_ kernel - RHDL uppercase sigma one with constant rotates.
- big_
sigma_ zero - SHA-256 uppercase sigma zero.
- big_
sigma_ zero_ kernel - RHDL uppercase sigma zero with constant rotates.
- choose
- SHA-256 choice function.
- choose_
kernel - RHDL SHA-256 choice function.
- compress_
block - Compresses one block and performs the mandated chaining-value feed-forward.
- compression_
kernel - RHDL lowering oracle for one complete compression operation.
- compression_
verilog - Emits the combinational compression oracle as Verilog.
- decode_
block - Decodes a 64-byte compression block into sixteen big-endian words.
- expand_
schedule - Expands sixteen input words into the complete 64-word SHA-256 schedule.
- feed_
forward_ kernel - Adds the final working variables to the input chaining value.
- majority
- SHA-256 majority function.
- majority_
kernel - RHDL SHA-256 majority function.
- padded_
block - Produces one padded SHA-256 block from an immutable byte stream.
- padded_
block_ count - Returns the number of 64-byte blocks after SHA-256 padding.
- rotate_
right - Rotates a software-model word right by a constant or dynamic count.
- round_
kernel - Executes exactly one SHA-256 round and advances the rolling schedule.
- round_
pipeline_ kernel - Connectivity kernel for
RoundPipeline. - round_
pipeline_ unchecked_ verilog - Emits a registered round-pipeline prefix without RHDL’s Icarus syntax check.
- round_
pipeline_ verilog - Emits a registered round-pipeline prefix as Verilog.
- round_
verilog - Emits the isolated RHDL round kernel as Verilog for synthesis gates.
- schedule_
kernel - Advances the sixteen-word rolling message-schedule window.
- sha256
- Hashes one byte slice with the correctness-first software model.
- small_
sigma_ one - SHA-256 lowercase sigma one.
- small_
sigma_ one_ kernel - RHDL lowercase sigma one with constant shifts and rotates.
- small_
sigma_ zero - SHA-256 lowercase sigma zero.
- small_
sigma_ zero_ kernel - RHDL lowercase sigma zero with constant shifts and rotates.