diff --git a/crypto/src/hash/mod.rs b/crypto/src/hash/mod.rs index 2337fe1..dec2761 100644 --- a/crypto/src/hash/mod.rs +++ b/crypto/src/hash/mod.rs @@ -2,6 +2,7 @@ use crate::{ElementHasher, HashFn}; mod rpo; pub use rpo::Rpo256 as Hasher; +pub use rpo::{INV_MDS, MDS}; // TYPE ALIASES // ================================================================================================ diff --git a/crypto/src/hash/rpo/digest.rs b/crypto/src/hash/rpo/digest.rs index f1ae3c2..3eef96f 100644 --- a/crypto/src/hash/rpo/digest.rs +++ b/crypto/src/hash/rpo/digest.rs @@ -94,33 +94,6 @@ impl Deref for RpoDigest256 { } } -impl RpoDigest256 { - fn iter(&self) -> RpoDigest256Iter<'_> { - RpoDigest256Iter { - values: &self.0, - index: 0, - } - } -} - -pub struct RpoDigest256Iter<'a> { - values: &'a [Felt; DIGEST_SIZE], - index: usize, -} - -impl<'a> Iterator for RpoDigest256Iter<'a> { - type Item = &'a Felt; - - fn next(&mut self) -> Option { - if self.index >= self.values.len() { - return None; - } - - self.index += 1; - Some(&self.values[self.index - 1]) - } -} - // TESTS // ================================================================================================ diff --git a/crypto/src/hash/rpo/mod.rs b/crypto/src/hash/rpo/mod.rs index 720e7d2..5a88eb8 100644 --- a/crypto/src/hash/rpo/mod.rs +++ b/crypto/src/hash/rpo/mod.rs @@ -378,7 +378,7 @@ impl Rpo256 { // MDS // ================================================================================================ /// RPO MDS matrix -const MDS: [[Felt; STATE_WIDTH]; STATE_WIDTH] = [ +pub const MDS: [[Felt; STATE_WIDTH]; STATE_WIDTH] = [ [ Felt::new(7), Felt::new(23), @@ -550,7 +550,7 @@ const MDS: [[Felt; STATE_WIDTH]; STATE_WIDTH] = [ ]; /// RPO Inverse MDS matrix -const INV_MDS: [[Felt; STATE_WIDTH]; STATE_WIDTH] = [ +pub const INV_MDS: [[Felt; STATE_WIDTH]; STATE_WIDTH] = [ [ Felt::new(14868391535953158196), Felt::new(13278298489594233127), diff --git a/crypto/src/merkle/mod.rs b/crypto/src/merkle/mod.rs index 6c8819b..63e5488 100644 --- a/crypto/src/merkle/mod.rs +++ b/crypto/src/merkle/mod.rs @@ -1,4 +1,7 @@ -use crate::{Felt, Word, ZERO}; +use crate::Word; + +#[cfg(test)] +use crate::{Felt, ZERO}; pub mod merkle_path_set; pub mod merkle_tree;