Remove `FieldExt` bound from `SqrtHasher` generic argument

This commit is contained in:
Jack Grigg 2022-11-24 09:33:21 +00:00
parent 0559163953
commit 4c86de5e10
1 changed files with 4 additions and 4 deletions

View File

@ -60,14 +60,14 @@ pub trait FieldExt: ff::PrimeField + Ord + Group<Scalar = Self> {
#[cfg(feature = "sqrt-table")]
#[cfg_attr(docsrs, doc(cfg(feature = "sqrt-table")))]
#[derive(Debug)]
struct SqrtHasher<F: FieldExt> {
struct SqrtHasher<F: SqrtTableHelpers> {
hash_xor: u32,
hash_mod: usize,
marker: PhantomData<F>,
}
#[cfg(feature = "sqrt-table")]
impl<F: FieldExt + SqrtTableHelpers> SqrtHasher<F> {
impl<F: SqrtTableHelpers> SqrtHasher<F> {
/// Returns a perfect hash of x for use with SqrtTables::inv.
fn hash(&self, x: &F) -> usize {
// This is just the simplest constant-time perfect hash construction that could
@ -82,7 +82,7 @@ impl<F: FieldExt + SqrtTableHelpers> SqrtHasher<F> {
#[cfg(feature = "sqrt-table")]
#[cfg_attr(docsrs, doc(cfg(feature = "sqrt-table")))]
#[derive(Debug)]
pub(crate) struct SqrtTables<F: FieldExt> {
pub(crate) struct SqrtTables<F: SqrtTableHelpers> {
hasher: SqrtHasher<F>,
inv: Vec<u8>,
g0: Box<[F; 256]>,
@ -92,7 +92,7 @@ pub(crate) struct SqrtTables<F: FieldExt> {
}
#[cfg(feature = "sqrt-table")]
impl<F: FieldExt + SqrtTableHelpers> SqrtTables<F> {
impl<F: SqrtTableHelpers> SqrtTables<F> {
/// Build tables given parameters for the perfect hash.
pub fn new(hash_xor: u32, hash_mod: usize) -> Self {
use alloc::vec;