From 48bab72d1f7016aa3decb7e5a1eb0bcbf8f921e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mamy=20Andr=C3=A9-Ratsimbazafy?= Date: Sun, 27 Sep 2020 17:39:45 +0200 Subject: [PATCH] cleanup leftover from BN curve inversion --- constantine/config/precompute.nim | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/constantine/config/precompute.nim b/constantine/config/precompute.nim index 055b2d0..5844555 100644 --- a/constantine/config/precompute.nim +++ b/constantine/config/precompute.nim @@ -458,35 +458,6 @@ func toCanonicalIntRepr*[bits: static int]( ## (octet-string) result.exportRawUint(a, bigEndian) -func bn_6u_minus_1_BE*[bits: static int]( - u: BigInt[bits] - ): array[(bits+7+3) div 8, byte] {.noInit.} = - ## For a BN curve - ## Precompute 6u-1 (for Little Fermat inversion) - ## and store it in canonical integer representation - # TODO: optimize output size - # each extra 0-bit is an extra useless squaring for a public exponent - # For example, for BN254-Snarks, u = 0x44E992B44A6909F1 (63-bit) - # and 6u+1 is 65-bit (not 66 as inferred) - - # Zero-extend "u" - var u_ext: BigInt[bits+3] - - for i in 0 ..< u.limbs.len: - u_ext.limbs[i] = u.limbs[i] - - # Addition chain to u -> 6u - discard u_ext.dbl() # u_ext = 2u - let u_ext2 = u_ext # u_ext2 = 2u - discard u_ext.dbl() # u_ext = 4u - discard u_ext.cadd(u_ext2, true) # u_ext = 6u - - # Sustract 1 - discard u_ext.sub(1) - - # Export - result.exportRawUint(u_ext, bigEndian) - # ############################################################ # # Compile-time Conversion to Montgomery domain