comment out unsafe state permutation

This commit is contained in:
M Alghazwi 2025-02-11 13:54:21 +01:00
parent f9fb82ee39
commit fbbe47bcc9
3 changed files with 6 additions and 6 deletions

View File

@ -24,7 +24,7 @@ fn bench_iterated_perm(c: &mut Criterion , h: Hash, n: usize) {
fn bench_permutations(c: &mut Criterion) { fn bench_permutations(c: &mut Criterion) {
bench_iterated_perm(c, Hash::Poseidon2, 10000); bench_iterated_perm(c, Hash::Poseidon2, 10000);
bench_iterated_perm(c, Hash::Griffin , 10000); bench_iterated_perm(c, Hash::Griffin , 10000);
bench_iterated_perm(c, Hash::Skyscraper , 10000); // bench_iterated_perm(c, Hash::Skyscraper , 10000);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -12,7 +12,7 @@ use crate::griffin;
pub enum Hash { pub enum Hash {
Poseidon2, Poseidon2,
Griffin, Griffin,
Skyscraper // Skyscraper
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -21,7 +21,7 @@ pub fn permute(h: Hash, s: State) -> State {
match h { match h {
Hash::Poseidon2 => poseidon2::permutation::permute(s), Hash::Poseidon2 => poseidon2::permutation::permute(s),
Hash::Griffin => griffin::permutation::permute(s), Hash::Griffin => griffin::permutation::permute(s),
Hash::Skyscraper => skyscraper::permutation::permute_state(s), // Hash::Skyscraper => skyscraper::permutation::permute_state(s),
} }
} }
@ -29,7 +29,7 @@ pub fn permute_inplace(h: Hash, s: &mut State){
match h { match h {
Hash::Poseidon2 => poseidon2::permutation::permute_inplace(s), Hash::Poseidon2 => poseidon2::permutation::permute_inplace(s),
Hash::Griffin => griffin::permutation::permute_inplace(s), Hash::Griffin => griffin::permutation::permute_inplace(s),
Hash::Skyscraper => skyscraper::permutation::permute_state_inplace(s), // Hash::Skyscraper => skyscraper::permutation::permute_state_inplace(s),
}; };
} }

View File

@ -122,7 +122,7 @@ pub fn permute(input: [F; 2]) -> [F; 2] {
/// WARNING: this ignores the z element of the state /// WARNING: this ignores the z element of the state
/// TODO: extension field /// TODO: extension field
pub fn permute_state_inplace(u: &mut State) { pub(crate) fn permute_state_inplace(u: &mut State) {
let ns = permute([u.x,u.y]); let ns = permute([u.x,u.y]);
u.x = ns[0]; u.x = ns[0];
u.y = ns[1]; u.y = ns[1];
@ -130,7 +130,7 @@ pub fn permute_state_inplace(u: &mut State) {
/// WARNING: this ignores the z element of the state /// WARNING: this ignores the z element of the state
/// TODO: extension field /// TODO: extension field
pub fn permute_state(mut u: State) -> State{ pub(crate) fn permute_state(mut u: State) -> State{
permute_state_inplace(&mut u); permute_state_inplace(&mut u);
u u
} }