pub struct DefaultFieldHasher<H: FixedOutputReset + Default + Clone, const SEC_PARAM: usize = 128> { /* private fields */ }
Expand description
This field hasher constructs a Hash-To-Field based on a fixed-output hash function, like SHA2, SHA3 or Blake2. The implementation aims to follow the specification in Hashing to Elliptic Curves (draft).
§Examples
use ark_ff::fields::field_hashers::{DefaultFieldHasher, HashToField};
use ark_test_curves::bls12_381::Fq;
use sha2::Sha256;
let hasher = <DefaultFieldHasher<Sha256> as HashToField<Fq>>::new(&[1, 2, 3]);
let field_elements: [Fq; 2] = hasher.hash_to_field(b"Hello, World!");
assert_eq!(field_elements.len(), 2);
Trait Implementations§
Source§impl<F: Field, H: FixedOutputReset + Default + Clone, const SEC_PARAM: usize> HashToField<F> for DefaultFieldHasher<H, SEC_PARAM>
impl<F: Field, H: FixedOutputReset + Default + Clone, const SEC_PARAM: usize> HashToField<F> for DefaultFieldHasher<H, SEC_PARAM>
Auto Trait Implementations§
impl<H, const SEC_PARAM: usize> Freeze for DefaultFieldHasher<H, SEC_PARAM>
impl<H, const SEC_PARAM: usize> RefUnwindSafe for DefaultFieldHasher<H, SEC_PARAM>where
H: RefUnwindSafe,
impl<H, const SEC_PARAM: usize> Send for DefaultFieldHasher<H, SEC_PARAM>where
H: Send,
impl<H, const SEC_PARAM: usize> Sync for DefaultFieldHasher<H, SEC_PARAM>where
H: Sync,
impl<H, const SEC_PARAM: usize> Unpin for DefaultFieldHasher<H, SEC_PARAM>where
H: Unpin,
impl<H, const SEC_PARAM: usize> UnwindSafe for DefaultFieldHasher<H, SEC_PARAM>where
H: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more