Arcium LogoArcium TS SDK Docs

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

ParameterTypeDescription
fieldFpFieldThe field to use (e.g., CURVE25519_BASE_FIELD).
modeRescueModeThe mode: block cipher or hash function.

Returns

RescueDesc

Properties

PropertyType
alphabigint
alphaInversebigint
fieldFpField
mnumber
mdsMatMatrix
mdsMatInverseMatrix
modeRescueMode
nRoundsnumber
roundKeysMatrix[]

Methods

permute()

permute(state): Matrix

Applies the Rescue permutation to a state matrix.

Parameters

ParameterTypeDescription
stateMatrixThe input state matrix.

Returns

Matrix

The permuted state matrix.


permuteInverse()

permuteInverse(state): Matrix

Applies the inverse Rescue permutation to a state matrix.

Parameters

ParameterTypeDescription
stateMatrixThe input state matrix.

Returns

Matrix

The inverse-permuted state matrix.


sampleConstants()

sampleConstants(nRounds): Matrix[]

Samples round constants for the Rescue permutation, using SHAKE256.

Parameters

ParameterTypeDescription
nRoundsnumberThe number of rounds.

Returns

Matrix[]

An array of round constant matrices.