pub struct DefaultFieldHasher<H: Default + DynDigest + 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: Vec<Fq> = hasher.hash_to_field(b"Hello, World!", 2);
assert_eq!(field_elements.len(), 2);
Trait Implementations§
Source§impl<F: Field, H: Default + DynDigest + Clone, const SEC_PARAM: usize> HashToField<F> for DefaultFieldHasher<H, SEC_PARAM>
impl<F: Field, H: Default + DynDigest + 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>where
H: Freeze,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more