show binary repr of -1 mod q

This commit is contained in:
narodnik
2020-10-07 00:54:28 +02:00
parent 6db00eac33
commit 7158df6a29
2 changed files with 9 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ q = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
modq = IntegersModP(q)
a = modq(-1)
print("a:", hex(a.n))
d = -(modq(10240)/modq(10241))
params = (a, d)

View File

@@ -29,4 +29,12 @@ fn main() {
])
.unwrap();
assert_eq!(Scalar::one(), one);
// Scalar stuff
println!("-Scalar::one: {:?}", -Scalar::one());
let bits = (-Scalar::one()).to_le_bits();
for b in bits.iter() {
print!("{}", if *b { 1 } else { 0 });
}
println!("");
}