RescuePrimeHash
The Rescue-Prime hash function, as described in https://eprint.iacr.org/2020/1143.pdf, offering 256 bits of security against collision, preimage and second-preimage attacks for any field of size at least 102 bits. We use the sponge construction with fixed rate = 7 and capacity = 5 (i.e., m = 12), and truncate the output to 5 field elements.
Constructors
Constructor
new RescuePrimeHash():
RescuePrimeHash
Constructs a RescuePrimeHash instance with rate = 7 and capacity = 5.
Returns
RescuePrimeHash
Properties
| Property | Type |
|---|---|
desc | RescueDesc |
digestLength | number |
rate | number |
Methods
digest()
digest(
message):bigint[]
Computes the Rescue-Prime hash of a message, with padding as described in Algorithm 2 of the paper.
Parameters
| Parameter | Type | Description |
|---|---|---|
message | bigint[] | The input message as an array of bigints. |
Returns
bigint[]
The hash output as an array of bigints (length = digestLength).