@arcium-hq/clientClasses
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
Construct a RescueDesc for a given field and mode (cipher or hash). Initialize round constants, MDS matrix, and key schedule.
Parameters
| Parameter | Type | Description |
|---|---|---|
field | FpField | Field to use (e.g., CURVE25519_BASE_FIELD). |
mode | RescueMode | 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
Apply the Rescue permutation to a state matrix.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | Matrix | Input state matrix. |
Returns
Matrix
Permuted state matrix.
permuteInverse()
permuteInverse(
state):Matrix
Apply the inverse Rescue permutation to a state matrix.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | Matrix | Input state matrix. |
Returns
Matrix
Inverse-permuted state matrix.
sampleConstants()
sampleConstants(
nRounds):Matrix[]
Sample round constants for the Rescue permutation, using SHAKE256.
Parameters
| Parameter | Type | Description |
|---|---|---|
nRounds | number | Number of rounds. |
Returns
Matrix[]
Array of round constant matrices.