Browse Source

Some (easy) cleanups as suggested from @daira.

Thanks!
master
Michele Orrù 7 years ago
parent
commit
2ac2d1213d
  1. 1
      src/bls12_381/ec.rs
  2. 1
      src/bls12_381/fq.rs
  3. 1
      src/bls12_381/fq2.rs
  4. 2
      src/lib.rs

1
src/bls12_381/ec.rs

@ -166,6 +166,7 @@ macro_rules! curve_impl {
fn into_projective(&self) -> $projective {
(*self).into()
}
}
impl Rand for $projective {

1
src/bls12_381/fq.rs

@ -814,6 +814,7 @@ impl SqrtField for Fq {
fn legendre(&self) -> ::LegendreSymbol {
use ::LegendreSymbol::*;
// s = self^((q - 1) // 2)
let s = self.pow([0xdcff7fffffffd555, 0xf55ffff58a9ffff, 0xb39869507b587b12,
0xb23ba5c279c2895f, 0x258dd3db21a5d66b, 0xd0088f51cbff34d]);
if s == Fq::zero() { Zero }

1
src/bls12_381/fq2.rs

@ -432,6 +432,7 @@ fn test_fq2_sqrt() {
fn test_fq2_legendre() {
use ::LegendreSymbol::*;
assert_eq!(Zero, Fq2::zero().legendre());
// i^2 = -1
let mut m1 = Fq2::one();
m1.negate();

2
src/lib.rs

@ -327,7 +327,7 @@ pub trait Field: Sized +
/// This trait represents an element of a field that has a square root operation described for it.
pub trait SqrtField: Field
{
/// Returns the legendre symbol of the field element.
/// Returns the Legendre symbol of the field element.
fn legendre(&self) -> LegendreSymbol;
/// Returns the square root of the field element, if it is

Loading…
Cancel
Save