Skip to content

Commit bebab86

Browse files
MauroToscanoOppen
andauthored
Derive hash FE (#460)
* Derive hash * More derive hash * Clippy --------- Co-authored-by: Mario Rugiero <[email protected]>
1 parent 56209f4 commit bebab86

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

math/src/field/element.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ use super::fields::montgomery_backed_prime_fields::{IsModulus, MontgomeryBackend
1212
use super::traits::{IsPrimeField, LegendreSymbol};
1313

1414
/// A field element with operations algorithms defined in `F`
15-
#[derive(Debug, Clone)]
15+
#[allow(clippy::derived_hash_with_manual_eq)]
16+
#[derive(Debug, Clone, Hash)]
1617
pub struct FieldElement<F: IsField> {
1718
value: F::BaseType,
1819
}

math/src/field/fields/fft_friendly/stark_252_prime_field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
unsigned_integer::element::{UnsignedInteger, U256},
88
};
99

10-
#[derive(Clone, Debug)]
10+
#[derive(Clone, Debug, Hash)]
1111
pub struct MontgomeryConfigStark252PrimeField;
1212
impl IsModulus<U256> for MontgomeryConfigStark252PrimeField {
1313
const MODULUS: U256 =

math/src/field/fields/montgomery_backed_prime_fields.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub trait IsModulus<U>: Debug {
1919
const MODULUS: U;
2020
}
2121

22-
#[derive(Clone, Debug)]
22+
#[derive(Clone, Debug, Hash)]
2323
pub struct MontgomeryBackendPrimeField<M, const NUM_LIMBS: usize> {
2424
phantom: PhantomData<M>,
2525
}

math/src/unsigned_integer/element.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub type U128 = UnsignedInteger<2>;
2121
/// The most significant bit is in the left-most position.
2222
/// That is, the array `[a_n, ..., a_0]` represents the
2323
/// integer 2^{64 * n} * a_n + ... + 2^{64} * a_1 + a_0.
24-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
24+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2525
pub struct UnsignedInteger<const NUM_LIMBS: usize> {
2626
pub limbs: [u64; NUM_LIMBS],
2727
}

0 commit comments

Comments
 (0)