mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-08 21:00:40 +00:00
Rename is_negative to is_negative_ed25519
This commit is contained in:
parent
5720e249ab
commit
3fc5f75300
2 changed files with 5 additions and 4 deletions
|
|
@ -159,7 +159,7 @@ impl CompressedEdwardsY {
|
||||||
X *= &constants::SQRT_M1;
|
X *= &constants::SQRT_M1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if X.is_negative() != (self[31] >> 7) as i32 {
|
if X.is_negative_ed25519() != (self[31] >> 7) as i32 {
|
||||||
X = X.neg();
|
X = X.neg();
|
||||||
}
|
}
|
||||||
T = &X * &Y;
|
T = &X * &Y;
|
||||||
|
|
@ -391,7 +391,7 @@ impl ProjectivePoint {
|
||||||
let mut s: [u8; 32];
|
let mut s: [u8; 32];
|
||||||
|
|
||||||
s = y.to_bytes();
|
s = y.to_bytes();
|
||||||
s[31] ^= (x.is_negative() << 7) as u8;
|
s[31] ^= (x.is_negative_ed25519() << 7) as u8;
|
||||||
CompressedEdwardsY(s)
|
CompressedEdwardsY(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -510,13 +510,14 @@ impl FieldElement {
|
||||||
(!equal_so_far & 1 & greater) as u8
|
(!equal_so_far & 1 & greater) as u8
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determine if this `FieldElement` is negative.
|
/// Determine if this `FieldElement` is negative, in the
|
||||||
|
/// sense used in the ed25519 paper.
|
||||||
///
|
///
|
||||||
/// # Return
|
/// # Return
|
||||||
///
|
///
|
||||||
/// If negative, return `1i32`. Otherwise, return `0i32`.
|
/// If negative, return `1i32`. Otherwise, return `0i32`.
|
||||||
// XXX should return u8
|
// XXX should return u8
|
||||||
pub fn is_negative(&self) -> i32 { //FeIsNegative
|
pub fn is_negative_ed25519(&self) -> i32 { //FeIsNegative
|
||||||
let bytes = self.to_bytes();
|
let bytes = self.to_bytes();
|
||||||
(bytes[0] & 1) as i32
|
(bytes[0] & 1) as i32
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue