You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Poseidon2](https://eprint.iacr.org/2023/323.pdf) is a cryptographic hash function designed specifically for field elements.
61
-
It is an improved version of the original [Poseidon](https://eprint.iacr.org/2019/458) hash, offering better performance on modern hardware. Poseidon2 is optimized for use with elliptic curve cryptography and finite fields, making it ideal for decentralized systems like blockchain. Its main advantage is balancing strong security with efficient computation, which is crucial for applications that require fast, reliable hashing.
61
+
It is an improved version of the original [Poseidon](https://eprint.iacr.org/2019/458) hash, offering better performance on modern hardware.
62
+
Poseidon2 is optimized for use with elliptic curve cryptography and finite fields, making it ideal for decentralized systems like blockchain.
63
+
Its main advantage is balancing strong security with efficient computation, which is crucial for applications that require fast, reliable hashing.
62
64
63
65
The optional `domain_tag` pointer parameter enables domain separation, allowing isolation of hash outputs across different contexts or applications.
64
66
65
-
:::info
67
+
The supported values of state size ***t*** as defined in [eprint 2023/323](https://eprint.iacr.org/2023/323.pdf) are 2, 3, 4, 8, 12, 16, 20 and 24.
68
+
Note that ***t*** sizes 8, 12, 16, 20 and 24 are supported only for small fields (babybear and m31).
66
69
67
-
The supported values of state size ***t*** as defined in [eprint 2023/323](https://eprint.iacr.org/2023/323.pdf) are 2, 3, 4, 8, 12, 16, 20 and 24. Note that ***t*** sizes 8, 12, 16, 20 and 24 are supported only for small fields (babybear and m31).
70
+
The S box power alpha, number of full rounds and partial rounds, rounds constants, MDS matrix, and partial matrix for each field and ***t*** can be
71
+
found in this [folder](https://github.com/ingonyama-zk/icicle/tree/9b1506cda9eab30fc6a8d0a338e2cfab877402f7/icicle/include/icicle/hash/poseidon2_constants/constants).
68
72
69
-
:::
73
+
There are two modes for using the Poseidon2 hash - sponge function and non-sponge (merkle tree) function. The key difference between these
74
+
modes is their execution pattern. The sponge function is inherently serial (each hash must wait for the previous hash to complete before
75
+
starting its own process), while the non-sponge function (which consists of multiple independent hashes that don't share inputs) runs in
76
+
parallel using GPU threads, with the number of threads equal to config.batch.
77
+
Another difference between two modes is that currently padding is supported for the sponge function and is not supported for the non-sponge.
78
+
For the sponge function the config.batch should be equal one.
70
79
71
-
:::info
72
-
73
-
The S box power alpha, number of full rounds and partial rounds, rounds constants, MDS matrix, and partial matrix for each field and ***t*** can be found in this [folder](https://github.com/ingonyama-zk/icicle/tree/9b1506cda9eab30fc6a8d0a338e2cfab877402f7/icicle/include/icicle/hash/poseidon2_constants/constants).
74
-
75
-
:::
76
-
77
-
In the current version the padding is not supported and should be performed by the user.
80
+
The hash function automatically chooses between these modes based on the input size. It runs in sponge mode if the input size (including the
81
+
domain_tag if present) is greater than the single hash width (in this case, config.batch should be set to one). Otherwise, it uses the non-sponge mode.
Currently the poseidon sponge mode (sponge function description could be found in Sec 2.1 of [eprint 2019/458](https://eprint.iacr.org/2019/458.pdf)) isn't implemented.
179
183
180
-
### 5. Poseidon2 sponge function
181
-
182
-
Currently the poseidon2 is implemented in compression mode, the sponge mode discussed in [eprint 2023/323](https://eprint.iacr.org/2023/323.pdf) is not implemented.
0 commit comments