Skip to content

Commit

Permalink
Report interesting moduli for BLS and BN curves
Browse files Browse the repository at this point in the history
  • Loading branch information
mratsim committed May 22, 2020
1 parent ff9dec4 commit 71a2acc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sage/curve_family_bls12.sage
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions sage/curve_family_bn.sage
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
Expand Down

0 comments on commit 71a2acc

Please sign in to comment.