Module poseidon2

Module poseidon2 

Source
Expand description

An implementation of Poseidon2 targeting the Baby Bear.

Structs§

Poseidon2HashSuite
A hash suite using Poseidon2 for both MT hashes and RNG
Poseidon2Rng
A random number generator driven by Poseidon2

Constants§

CELLS
The number of state elements (also known as “cells”) used in the Poseidon2 hash function.
CELLS_OUT
The size of the hash output in cells (~ 248 bits)
CELLS_RATE
The ‘rate’ of the sponge, i.e. how much we can safely add/remove per mixing.
M_INT_DIAG_HZN
Standardizing on the same coefficients as https://github.com/HorizenLabs/poseidon2.git (as used in its plain implementation of Poseidon2 for BabyBear)
ROUNDS_HALF_FULL
The number of full S-box rounds in the first and last half of the Poseidon2 permutation.
ROUNDS_PARTIAL
The number of partial S-box rounds in the middle of the Poseidon2 permutation.
ROUND_CONSTANTS
Round constants used in the Poseidon2 permutation.

Functions§

poseidon2_mix
The raw sponge mixing function
unpadded_hash
Perform an unpadded hash of a vector of elements. Because this is unpadded collision resistance is only true for vectors of the same size. If the size is variable, this is subject to length extension attacks.