From 71a2acc2021ef2b4acd3da21dab45e9ec82558de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mamy=20Andr=C3=A9-Ratsimbazafy?= Date: Fri, 22 May 2020 17:55:03 +0200 Subject: [PATCH] Report interesting moduli for BLS and BN curves --- sage/curve_family_bls12.sage | 7 ++++++- sage/curve_family_bn.sage | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sage/curve_family_bls12.sage b/sage/curve_family_bls12.sage index 701c8aa..a8324a0 100644 --- a/sage/curve_family_bls12.sage +++ b/sage/curve_family_bls12.sage @@ -30,9 +30,14 @@ def compute_curve_characteristic(u_str): else: print(' Parameter u (hex): 0x' + u.hex()) + print(f' p mod 4: ' + str(p % 4)) + print(f' p mod 8: ' + str(p % 8)) + print(f' p mod 12: ' + str(p % 12)) + print(f' p mod 16: ' + str(p % 16)) + if __name__ == "__main__": # Usage - # sage '-(2^63 + 2^62 + 2^60 + 2^57 + 2^48 + 2^16)' + # sage sage/curve_family_bls12.sage '-(2^63 + 2^62 + 2^60 + 2^57 + 2^48 + 2^16)' from argparse import ArgumentParser diff --git a/sage/curve_family_bn.sage b/sage/curve_family_bn.sage index 2a2a443..2b81286 100644 --- a/sage/curve_family_bn.sage +++ b/sage/curve_family_bn.sage @@ -30,6 +30,11 @@ def compute_curve_characteristic(u_str): else: print(' Parameter u (hex): 0x' + u.hex()) + print(f' p mod 4: ' + str(p % 4)) + print(f' p mod 8: ' + str(p % 8)) + print(f' p mod 12: ' + str(p % 12)) + print(f' p mod 16: ' + str(p % 16)) + if __name__ == "__main__": # Usage # sage sage/curve_family_bn.sage '-(2^62 + 2^55 + 1)'