mirror of
https://github.com/anonklub/poseidon.git
synced 2026-01-08 23:27:56 -05:00
derive CanonicalSerialize and CanonicalDeserialize
This commit is contained in:
@@ -8,6 +8,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
|
||||
ark-ff = "0.4.2"
|
||||
ark-serialize = { version = "0.4.2", features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
ark-secp256k1 = "0.4.0"
|
||||
|
||||
@@ -2,8 +2,9 @@ pub mod constants;
|
||||
pub mod sponge;
|
||||
|
||||
use ark_ff::Field;
|
||||
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, CanonicalSerialize, CanonicalDeserialize)]
|
||||
pub struct PoseidonConstants<F: Field> {
|
||||
pub round_keys: Vec<F>,
|
||||
pub mds_matrix: Vec<Vec<F>>,
|
||||
@@ -13,7 +14,7 @@ pub struct PoseidonConstants<F: Field> {
|
||||
|
||||
const CAPACITY: usize = 1; // We fix the capacity to be one.
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, CanonicalDeserialize, CanonicalSerialize)]
|
||||
pub struct Poseidon<F: Field, const WIDTH: usize> {
|
||||
pub state: [F; WIDTH],
|
||||
pub constants: PoseidonConstants<F>,
|
||||
|
||||
Reference in New Issue
Block a user