RescueDesc
Description and parameters for the Rescue cipher or hash function, including round constants, MDS matrix, and key schedule. See: https://tosc.iacr.org/index.php/ToSC/article/view/8695/8287
Constructors
Constructor
new RescueDesc(
field
,mode
):RescueDesc
Constructs a RescueDesc for a given field and mode (cipher or hash). Initializes round constants, MDS matrix, and key schedule.
Parameters
Parameter | Type | Description |
---|---|---|
field | FpField | The field to use (e.g., CURVE25519_BASE_FIELD). |
mode | RescueMode | The mode: block cipher or hash function. |
Returns
RescueDesc
Properties
Property | Type |
---|---|
alpha | bigint |
alphaInverse | bigint |
field | FpField |
m | number |
mdsMat | Matrix |
mdsMatInverse | Matrix |
mode | RescueMode |
nRounds | number |
roundKeys | Matrix [] |
Methods
permute()
permute(
state
):Matrix
Applies the Rescue permutation to a state matrix.
Parameters
Parameter | Type | Description |
---|---|---|
state | Matrix | The input state matrix. |
Returns
The permuted state matrix.
permuteInverse()
permuteInverse(
state
):Matrix
Applies the inverse Rescue permutation to a state matrix.
Parameters
Parameter | Type | Description |
---|---|---|
state | Matrix | The input state matrix. |
Returns
The inverse-permuted state matrix.
sampleConstants()
sampleConstants(
nRounds
):Matrix
[]
Samples round constants for the Rescue permutation, using SHAKE256.
Parameters
Parameter | Type | Description |
---|---|---|
nRounds | number | The number of rounds. |
Returns
Matrix
[]
An array of round constant matrices.