mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Move sqrt(-(A+2)) test to constants.rs
This commit is contained in:
parent
3a9ee16a30
commit
0585af6c68
2 changed files with 10 additions and 11 deletions
|
|
@ -1625,6 +1625,16 @@ mod test {
|
|||
assert_eq!(one, &two * &constants::HALF);
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// Test that the constant for sqrt(-486664) really is a square
|
||||
/// root of -486664.
|
||||
fn sqrt_minus_aplus2() {
|
||||
let minus_aplus2 = FieldElement([-486664,0,0,0,0,0,0,0,0,0]);
|
||||
let sqrt = constants::SQRT_MINUS_APLUS2;
|
||||
let sq = &sqrt * &sqrt;
|
||||
assert_eq!(sq, minus_aplus2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// Test that SQRT_M1 and MSQRT_M1 are square roots of -1
|
||||
fn test_sqrt_minus_one() {
|
||||
|
|
|
|||
11
src/curve.rs
11
src/curve.rs
|
|
@ -1074,17 +1074,6 @@ mod test {
|
|||
0xc0, 0x46, 0x83, 0x43, 0xde, 0x70, 0x4b, 0x85,
|
||||
0x09, 0x6f, 0xfe, 0x35, 0x4f, 0x13, 0x2b, 0x42]);
|
||||
|
||||
#[test]
|
||||
/// Test that the constant for sqrt(-486664) really is a square
|
||||
/// root of -486664.
|
||||
/// XXX this should be a test in constants.rs ??
|
||||
fn sqrt_minus_aplus2() {
|
||||
let minus_aplus2 = FieldElement([-486664,0,0,0,0,0,0,0,0,0]);
|
||||
let sqrt = constants::SQRT_MINUS_APLUS2;
|
||||
let sq = &sqrt * &sqrt;
|
||||
assert_eq!(sq, minus_aplus2);
|
||||
}
|
||||
|
||||
/// Test Montgomery conversion against the X25519 basepoint.
|
||||
#[test]
|
||||
fn basepoint_to_montgomery() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue