mirror of
https://github.com/logos-storage/rust-bn254-hash.git
synced 2026-01-02 05:43:07 +00:00
comment out unsafe state permutation
This commit is contained in:
parent
f9fb82ee39
commit
fbbe47bcc9
@ -24,7 +24,7 @@ fn bench_iterated_perm(c: &mut Criterion , h: Hash, n: usize) {
|
||||
fn bench_permutations(c: &mut Criterion) {
|
||||
bench_iterated_perm(c, Hash::Poseidon2, 10000);
|
||||
bench_iterated_perm(c, Hash::Griffin , 10000);
|
||||
bench_iterated_perm(c, Hash::Skyscraper , 10000);
|
||||
// bench_iterated_perm(c, Hash::Skyscraper , 10000);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@ -12,7 +12,7 @@ use crate::griffin;
|
||||
pub enum Hash {
|
||||
Poseidon2,
|
||||
Griffin,
|
||||
Skyscraper
|
||||
// Skyscraper
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -21,7 +21,7 @@ pub fn permute(h: Hash, s: State) -> State {
|
||||
match h {
|
||||
Hash::Poseidon2 => poseidon2::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 {
|
||||
Hash::Poseidon2 => poseidon2::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),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ pub fn permute(input: [F; 2]) -> [F; 2] {
|
||||
|
||||
/// WARNING: this ignores the z element of the state
|
||||
/// 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]);
|
||||
u.x = ns[0];
|
||||
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
|
||||
/// 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);
|
||||
u
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user