Skip to main content

Crate keccak_rhdl

Crate keccak_rhdl 

Source
Expand description

Legacy Keccak-256 primitives for the HashSigsRS compatibility profile.

This crate deliberately implements Keccak-256, whose final partial block uses the legacy 0x01 domain byte. It does not implement FIPS 202 SHA3-256, whose corresponding byte is 0x06. Confusing those encodings produces unrelated digests and therefore incompatible HashSigs keys and signatures.

The hardware-facing foundation is split into three layers:

  • keccak_round is one fully combinational Keccak-f[1600] round. Its rotation offsets and lane destinations are compile-time constants.
  • keccak_f1600 composes all 24 rounds and is useful as a correctness oracle and an RTL generation target. It is not the intended area-efficient implementation.
  • IterativeKeccak stores one 1,600-bit state and applies one round per cycle. A request accepted while IterativeOutput::ready is true emits a one-cycle IterativeOutput::done pulse after exactly 24 round cycles.

LegacyKeccak256 is a software/block-packing model used by tests and by downstream schedulers. It exposes 136-byte rate blocks in the same little-endian lane order consumed by the RHDL absorption kernel. This keeps variable-length byte buffering out of the permutation core while covering every HashSigs message size (32, 35, 64, and 2,144 bytes).

§Evidence boundary

The tests exercise the Rust model, RHDL VM, lowered RTL VM, and emitted Verilog in Icarus. No synthesis, utilization, timing, route, or physical hardware claim follows from those tests.

Re-exports§

pub use permutation::keccak_f1600;
pub use round::keccak_round;
pub use round::keccak_round_00;
pub use round::keccak_round_01;
pub use round::keccak_round_02;
pub use round::keccak_round_03;
pub use round::keccak_round_04;
pub use round::keccak_round_05;
pub use round::keccak_round_06;
pub use round::keccak_round_07;
pub use round::keccak_round_08;
pub use round::keccak_round_09;
pub use round::keccak_round_10;
pub use round::keccak_round_11;
pub use round::keccak_round_12;
pub use round::keccak_round_13;
pub use round::keccak_round_14;
pub use round::keccak_round_15;
pub use round::keccak_round_16;
pub use round::keccak_round_17;
pub use round::keccak_round_18;
pub use round::keccak_round_19;
pub use round::keccak_round_20;
pub use round::keccak_round_21;
pub use round::keccak_round_22;
pub use round::keccak_round_23;
pub use sponge::absorb_rate_block;
pub use sponge::xor_rate_block;

Structs§

IterativeInput
Request presented to IterativeKeccak.
IterativeKeccak
A synthesizable Keccak-f[1600] engine that reuses one round cell.
IterativeOutput
Status and result produced by IterativeKeccak.
LegacyKeccak256
Host-side legacy Keccak-256 sponge and block-packing model.
RateBlock
One 1,088-bit Keccak-256 absorption block.

Constants§

LEGACY_DOMAIN_BYTE
Domain byte used by legacy Keccak padding.
RATE_BYTES
Keccak-256’s byte rate (1600 - 2*256 bits).
RATE_LANES
Keccak-256’s rate expressed as 64-bit lanes.
ROTATION_OFFSETS
Keccak-f[1600] Rho offsets indexed as [x][y].
ROUND_CONSTANTS
The 24 Keccak-f[1600] Iota constants, in round order.
ROUND_COUNT
Number of rounds in Keccak-f[1600].

Functions§

absorb_rate_block
XOR one complete rate block into a state and permute it.
digest_from_state
Extract the first 256 rate bits as a Keccak digest.
generate_iterative_verilog
Generate the 24-cycle iterative engine and its RHDL-owned storage modules.
generate_permutation_verilog
Generate a standalone 24-round combinational permutation module.
generate_round_verilog
Generate a standalone combinational one-round Verilog module.
keccak_f1600
Apply all 24 Keccak-f[1600] rounds as one combinational RHDL kernel.
keccak_round
Apply one Keccak-f[1600] round selected at runtime.
keccak_round_00
Apply compile-time Keccak-f[1600] round 0.
keccak_round_01
Apply compile-time Keccak-f[1600] round 1.
keccak_round_02
Apply compile-time Keccak-f[1600] round 2.
keccak_round_03
Apply compile-time Keccak-f[1600] round 3.
keccak_round_04
Apply compile-time Keccak-f[1600] round 4.
keccak_round_05
Apply compile-time Keccak-f[1600] round 5.
keccak_round_06
Apply compile-time Keccak-f[1600] round 6.
keccak_round_07
Apply compile-time Keccak-f[1600] round 7.
keccak_round_08
Apply compile-time Keccak-f[1600] round 8.
keccak_round_09
Apply compile-time Keccak-f[1600] round 9.
keccak_round_10
Apply compile-time Keccak-f[1600] round 10.
keccak_round_11
Apply compile-time Keccak-f[1600] round 11.
keccak_round_12
Apply compile-time Keccak-f[1600] round 12.
keccak_round_13
Apply compile-time Keccak-f[1600] round 13.
keccak_round_14
Apply compile-time Keccak-f[1600] round 14.
keccak_round_15
Apply compile-time Keccak-f[1600] round 15.
keccak_round_16
Apply compile-time Keccak-f[1600] round 16.
keccak_round_17
Apply compile-time Keccak-f[1600] round 17.
keccak_round_18
Apply compile-time Keccak-f[1600] round 18.
keccak_round_19
Apply compile-time Keccak-f[1600] round 19.
keccak_round_20
Apply compile-time Keccak-f[1600] round 20.
keccak_round_21
Apply compile-time Keccak-f[1600] round 21.
keccak_round_22
Apply compile-time Keccak-f[1600] round 22.
keccak_round_23
Apply compile-time Keccak-f[1600] round 23.
software_keccak_f1600
Independent native-Rust Keccak-f[1600] permutation.
software_keccak_round
Independent native-Rust implementation of one Keccak-f[1600] round.
xor_rate_block
XOR one complete rate block into the 17 rate lanes of a state.

Type Aliases§

Digest
A 256-bit Keccak digest in byte order.
KeccakState
A Keccak-f[1600] state in the canonical x + 5*y lane order.