Skip to content

Commit

Permalink
The hasher H could be PhantomData already.
Browse files Browse the repository at this point in the history
  • Loading branch information
¨Jeff committed Sep 19, 2023
1 parent 5aa053b commit 34a7211
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ff/src/fields/field_hashers/expander/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// The below implementation is a rework of https://github.com/armfazh/h2c-rust-ref
// With some optimisations

use core::marker::PhantomData;

use ark_std::vec::Vec;

use arrayvec::ArrayVec;
Expand Down Expand Up @@ -55,7 +57,7 @@ impl DST {
}

pub(super) struct ExpanderXof<H: ExtendableOutput + Clone + Default> {
pub(super) xofer: H,
pub(super) xofer: PhantomData<H>,
pub(super) dst: Vec<u8>,
pub(super) k: usize,
}
Expand All @@ -75,7 +77,7 @@ impl<H: ExtendableOutput + Clone + Default> Expander for ExpanderXof<H> {
}

pub(super) struct ExpanderXmd<H: FixedOutputReset + Default + Clone> {
pub(super) hasher: H,
pub(super) hasher: PhantomData<H>,
pub(super) dst: Vec<u8>,
pub(super) block_size: usize,
}
Expand Down
4 changes: 3 additions & 1 deletion ff/src/fields/field_hashers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
mod expander;

use core::marker::PhantomData;

use crate::{Field, PrimeField};

use digest::{FixedOutputReset, XofReader};
Expand Down Expand Up @@ -50,7 +52,7 @@ impl<F: Field, H: FixedOutputReset + Default + Clone, const SEC_PARAM: usize> Ha
let len_per_base_elem = get_len_per_elem::<F, SEC_PARAM>();

let expander = ExpanderXmd {
hasher: H::default(),
hasher: PhantomData,
dst: dst.to_vec(),
block_size: len_per_base_elem,
};
Expand Down

0 comments on commit 34a7211

Please sign in to comment.