Browse Source

Sqrt fq2 bls12 381 regression (#89)

Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
update-to-latest-arkworks
Marcin 2 years ago
committed by GitHub
parent
commit
d0dc200f22
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      bls12_381/src/fields/tests.rs

+ 13
- 0
bls12_381/src/fields/tests.rs

@ -1117,6 +1117,19 @@ fn test_fq_repr_add_nocarry() {
assert!(x.is_zero()); assert!(x.is_zero());
} }
#[test]
fn test_fq2_sqrt() {
// 1 has a sqrt in the base field
let fq2_sqrt = Fq2::new(Fq::one(), Fq::zero()).sqrt().unwrap();
assert_eq!(fq2_sqrt.c0, Fq::one());
assert_eq!(fq2_sqrt.c1, Fq::zero());
// -1 has no sqrt in the base field, but should be valid in Fq2
let fq2_sqrt = Fq2::new(-Fq::one(), Fq::zero()).sqrt().unwrap();
assert_eq!(fq2_sqrt.c0, Fq::zero());
assert_eq!(fq2_sqrt.c1, Fq::one());
}
#[test] #[test]
fn test_fq_num_bits() { fn test_fq_num_bits() {
assert_eq!(FqParameters::MODULUS_BITS, 381); assert_eq!(FqParameters::MODULUS_BITS, 381);

Loading…
Cancel
Save