diff --git a/nimue/Cargo.toml b/nimue/Cargo.toml index c6bfce1..d479319 100644 --- a/nimue/Cargo.toml +++ b/nimue/Cargo.toml @@ -10,6 +10,7 @@ license = "BSD-3-Clause" zeroize = { version = "1.6.0", features = ["zeroize_derive"] } rand = { version = "0.8", features = ["getrandom"] } digest = "^0.10.7" +serde = "^1.0" # used as default hasher for the prover keccak = { version = "0.1.4"} log = "0.4.20" diff --git a/nimue/src/iopattern.rs b/nimue/src/iopattern.rs index 939e8d0..a2ea47f 100644 --- a/nimue/src/iopattern.rs +++ b/nimue/src/iopattern.rs @@ -9,6 +9,7 @@ use std::marker::PhantomData; use super::errors::IOPatternError; use super::hash::{DuplexHash, Unit}; +use serde::{Deserialize, Serialize}; /// This is the separator between operations in the IO Pattern /// and as such is the only forbidden character in labels. @@ -34,7 +35,7 @@ const SEP_BYTE: &str = "\0"; /// The struct [`IOPattern`] guarantees the creation of a valid IO Pattern string, whose lengths are coherent with the types described in the protocol. No information about the types themselves is stored in an IO Pattern. /// This means that [`Merlin`][`crate::Merlin`] or [`Arthur`][`crate::Arthur`] instances can generate successfully a protocol transcript respecting the length constraint but not the types. See [issue #6](https://github.com/arkworks-rs/nimue/issues/6) for a discussion on the topic. -#[derive(Clone)] +#[derive(Clone, Eq, PartialEq, Serialize, Deserialize)] pub struct IOPattern where U: Unit, diff --git a/nimue/src/merlin.rs b/nimue/src/merlin.rs index fca84da..0f4860c 100644 --- a/nimue/src/merlin.rs +++ b/nimue/src/merlin.rs @@ -13,6 +13,7 @@ use super::{DefaultHash, DefaultRng, IOPatternError}; /// it is seeded by a cryptographic random number generator (by default, [`rand::rngs::OsRng`]). /// /// Every time the prover's sponge is squeeze, the state of the sponge is ratcheted, so that it can't be inverted and the randomness recovered. +#[derive(Clone)] pub(crate) struct ProverRng { /// The sponge that is used to generate the random coins. pub(crate) sponge: Keccak, @@ -88,6 +89,7 @@ where /// Unless otherwise specified, /// [`Merlin`] is set to work over bytes with [`DefaultHash`] and /// rely on the default random number generator [`DefaultRng`]. +#[derive(Clone)] pub struct Merlin where U: Unit,