mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-01-31 07:42:15 +00:00
Some (easy) cleanups as suggested from @daira.
Thanks!
This commit is contained in:
parent
a86d0b7270
commit
2ac2d1213d
@ -166,6 +166,7 @@ macro_rules! curve_impl {
|
||||
fn into_projective(&self) -> $projective {
|
||||
(*self).into()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl Rand for $projective {
|
||||
|
@ -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 }
|
||||
|
@ -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();
|
||||
|
@ -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…
Reference in New Issue
Block a user