From b8394bf14dca69c2105cf7d34f1a76dd78db283e Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Sun, 26 Nov 2017 03:09:06 -0700 Subject: [PATCH] Fix some comments. --- src/bls12_381/fq.rs | 4 ++-- src/bls12_381/fr.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bls12_381/fq.rs b/src/bls12_381/fq.rs index 6c0b196..749f251 100644 --- a/src/bls12_381/fq.rs +++ b/src/bls12_381/fq.rs @@ -18,7 +18,7 @@ const R: FqRepr = FqRepr([0x760900000002fffd, 0xebf4000bc40c0002, 0x5f48985753c7 // R2 = R^2 % q const R2: FqRepr = FqRepr([0xf4df1f341c341746, 0xa76e6a609d104f1, 0x8de5476c4c95b6d5, 0x67eb88a9939d83c0, 0x9a793e85b519952d, 0x11988fe592cae3aa]); -// INV = -(q^{-1} mod q) mod q +// INV = -(q^{-1} mod 2^64) mod 2^64 const INV: u64 = 0x89f3fffcfffcfffd; // GENERATOR = 2 (multiplicative generator of q-1 order, that is also quadratic nonresidue) @@ -823,7 +823,7 @@ impl SqrtField for Fq { // Shank's algorithm for q mod 4 = 3 // https://eprint.iacr.org/2012/685.pdf (page 9, algorithm 2) - // a1 = self^((q - 3) // 2) + // a1 = self^((q - 3) // 4) let mut a1 = self.pow([0xee7fbfffffffeaaa, 0x7aaffffac54ffff, 0xd9cc34a83dac3d89, 0xd91dd2e13ce144af, 0x92c6e9ed90d2eb35, 0x680447a8e5ff9a6]); let mut a0 = a1; a0.square(); diff --git a/src/bls12_381/fr.rs b/src/bls12_381/fr.rs index 629984d..96ef599 100644 --- a/src/bls12_381/fr.rs +++ b/src/bls12_381/fr.rs @@ -17,7 +17,7 @@ const R: FrRepr = FrRepr([0x1fffffffe, 0x5884b7fa00034802, 0x998c4fefecbc4ff5, 0 // R2 = R^2 % r const R2: FrRepr = FrRepr([0xc999e990f3f29c6d, 0x2b6cedcb87925c23, 0x5d314967254398f, 0x748d9d99f59ff11]); -// INV = -(r^{-1} mod r) mod r +// INV = -(r^{-1} mod 2^64) mod 2^64 const INV: u64 = 0xfffffffeffffffff; // GENERATOR = 7 (multiplicative generator of r-1 order, that is also quadratic nonresidue)