SLH-DSA addresses #
This module formalizes the address (ADRS) formats from FIPS 205, Sections 4.2--4.4,
Figures 2--9 and Table 1. An address consists of a 32-bit layer address, a 96-bit tree address,
a 32-bit type, and three 32-bit type-dependent words. Address.setTypeAndClear implements the
standard's requirement that changing the type clears the final 12 bytes.
Address.toBits is the canonical 32-byte, big-endian encoding used by the SHAKE parameter sets,
and Address.toBytes gives its typed byte view. The SHA2 parameter sets instead use the 22-byte
compressed address Address.toCompressedBits from FIPS 205, Section 11.2, Figure 18 and Table 3;
Address.toCompressedBytes gives its typed byte view. Compression retains only one byte of the
layer, eight bytes of the tree, and one byte of the type. Address.FitsCompressed records the
bounds under which that projection is injective; the unrestricted compressed encoding is
deliberately not claimed to be injective.
This is only the address-domain layer. It does not define the FIPS 205 hash instantiations, WOTS+, XMSS, FORS, the hypertree, signing or verification, or any security reduction.
Main definitions #
Cslib.Crypto.SLHDSA.AddressType: the seven FIPS 205 address types.Cslib.Crypto.SLHDSA.Address: the eight-word canonical address.Cslib.Crypto.SLHDSA.Address.setTypeAndClear: change the type and clear the final three words.Cslib.Crypto.SLHDSA.Address.toBits: the canonical 256-bit big-endian encoding.Cslib.Crypto.SLHDSA.Address.toBytes: the canonical typed 32-byte encoding.Cslib.Crypto.SLHDSA.Address.toCompressedBits: the 176-bit SHA2 address encoding.Cslib.Crypto.SLHDSA.Address.toCompressedBytes: the typed 22-byte SHA2 address encoding.Cslib.Crypto.SLHDSA.Address.WellFormed: the type-specific padding and fixed-field conditions.
Main results #
Cslib.Crypto.SLHDSA.Address.toBits_injective: canonical serialization is injective.Cslib.Crypto.SLHDSA.Address.toBytes_injective: canonical byte serialization is injective.Cslib.Crypto.SLHDSA.Address.toCompressedBits_injective_of_fits: compressed serialization is injective when its retained layer and tree fields do not overflow.Cslib.Crypto.SLHDSA.Address.toCompressedBytes_injective_of_fits: the same contract for typed bytes.Cslib.Crypto.SLHDSA.Address.setTypeAndClear_payload: changing type clears all 96 payload bits.Cslib.Crypto.SLHDSA.Address.wellFormed_*: each typed constructor satisfies its FIPS layout.
References #
- [NIST, Stateless Hash-Based Digital Signature Standard, Sections 4.2--4.4 and 11.2] [NIST24c]
One four-byte FIPS 205 address word.
The three-word tree address in an SLH-DSA address.
The seven address types from FIPS 205, Section 4.2, Figures 3--9.
- wotsHash : AddressType
A hash step within a WOTS+ chain (type 0).
- wotsPK : AddressType
WOTS+ public-key compression (type 1).
- tree : AddressType
A hash-tree node within XMSS (type 2).
- forsTree : AddressType
A node within one of the FORS trees (type 3).
- forsRoots : AddressType
Compression of the FORS roots (type 4).
- wotsPRF : AddressType
Generation of a WOTS+ secret value (type 5).
- forsPRF : AddressType
Generation of a FORS secret value (type 6).
Instances For
The integer type code specified by FIPS 205.
Every FIPS 205 address-type code fits in one byte.
The type code as a four-byte address word.
Distinct address types have distinct FIPS 205 integer codes.
The big-endian bits of one four-byte address word.
A serialized four-byte address word has 32 bits.
Reading a serialized four-byte address word recovers its unsigned value.
The big-endian bits of the 12-byte tree address.
A serialized tree address has 96 bits.
Reading a serialized tree address recovers its unsigned value.
A FIPS 205 address as its common fields and three type-dependent words.
The field names word5, word6, and word7 refer to their zero-based positions in the eight-word
address. Their meanings are fixed by addressType; use the typed constructors below to obtain a
well-formed address for a particular purpose.
- layerAddress : AddressWord
The XMSS layer, stored in word 0.
- treeAddress : TreeAddress
The XMSS tree within the layer, stored in words 1--3.
- addressType : AddressType
The address type, stored in word 4.
- word5 : AddressWord
The first type-dependent word.
- word6 : AddressWord
The second type-dependent word.
- word7 : AddressWord
The third type-dependent word.
Instances For
Two addresses are equal when all seven semantic fields agree.
The big-endian four-byte encoding of an address type.
A serialized address type occupies one four-byte word.
The canonical 32-byte encoding of an address (FIPS 205, Figure 2 and Table 1).
The canonical address as exactly 32 big-endian bytes.
The canonical 32-byte address encoding is injective.
The canonical 32-byte encoding is injective for arbitrary addresses.
The 22-byte compressed address used by the FIPS 205 SHA2 parameter sets.
This is ADRS[3] || ADRS[8:16] || ADRS[19] || ADRS[20:32]: the low byte of the layer,
the low eight bytes of the tree, the low byte of the type, and all three type-dependent words.
A SHA2 compressed address encoding is exactly 22 bytes.
The compressed SHA2 address as exactly 22 big-endian bytes.
If a layer address fits in the retained byte, reading that byte recovers it.
If a tree address fits in the retained eight bytes, reading those bytes recovers it.
Reading the retained type byte recovers the FIPS 205 type code.
The bound under which the one-byte layer and eight-byte tree fields of the compressed SHA2 address lose no information. FIPS 205 parameter sets satisfy these bounds at every call site.
Instances For
Compressed SHA2 address serialization is injective when neither shortened field overflows.
The compressed 22-byte encoding is injective when neither shortened field overflows.
Set the layer address, preserving every other word.
Set the 12-byte tree address, preserving every other word.
Change the address type and clear all three type-dependent words (FIPS 205, Section 4.3).
Set the key-pair address in word 5.
Set the WOTS+ chain address in word 6.
Set the tree height in word 6.
Set the WOTS+ hash address in word 7.
Set the tree index in word 7.
Changing the type preserves the layer and tree fields.
Changing the type sets the requested type and clears all final 12 bytes.
The padding and fixed-field requirements of FIPS 205, Figures 3--9.
Instances For
A WOTS+ hash-chain address (FIPS 205, Figure 3).
A WOTS+ public-key compression address (FIPS 205, Figure 4).
An XMSS hash-tree address (FIPS 205, Figure 5).
A FORS tree address (FIPS 205, Figure 6). The FORS layer is fixed to zero.
A FORS roots-compression address (FIPS 205, Figure 7).
A WOTS+ secret-value generation address (FIPS 205, Figure 8).
A FORS secret-value generation address (FIPS 205, Figure 9).