Skip to main content

Crate sha256_rhdl

Crate sha256_rhdl 

Source
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; and
  • farm::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§

PipelineWord
Pipeline payload. state is meaningful only while valid is true.
RoundPipeline
A resetless, fully registered prefix of the 64-round SHA-256 pipeline.
RoundState
Complete 768-bit datapath token for one SHA-256 round.
WorkingState
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 HashSigs PRF 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.