sage: Reorganize files
* Move curve parameters to separate file * Rename main prover script for clarity
This commit is contained in:
parent
13c88efed0
commit
f554dfc708
@ -1,9 +1,4 @@
|
|||||||
# Define field size and field
|
load("secp256k1_params.sage")
|
||||||
P = 2^256 - 2^32 - 977
|
|
||||||
F = GF(P)
|
|
||||||
BETA = F(0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee)
|
|
||||||
|
|
||||||
assert(BETA != F(1) and BETA^3 == F(1))
|
|
||||||
|
|
||||||
orders_done = set()
|
orders_done = set()
|
||||||
results = {}
|
results = {}
|
||||||
|
32
sage/secp256k1_params.sage
Normal file
32
sage/secp256k1_params.sage
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"""Prime order of finite field underlying secp256k1 (2^256 - 2^32 - 977)"""
|
||||||
|
P = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F
|
||||||
|
|
||||||
|
"""Finite field underlying secp256k1"""
|
||||||
|
F = FiniteField(P)
|
||||||
|
|
||||||
|
"""Elliptic curve secp256k1: y^2 = x^3 + 7"""
|
||||||
|
C = EllipticCurve([F(0), F(7)])
|
||||||
|
|
||||||
|
"""Base point of secp256k1"""
|
||||||
|
G = C.lift_x(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798)
|
||||||
|
|
||||||
|
"""Prime order of secp256k1"""
|
||||||
|
N = C.order()
|
||||||
|
|
||||||
|
"""Finite field of scalars of secp256k1"""
|
||||||
|
Z = FiniteField(N)
|
||||||
|
|
||||||
|
""" Beta value of secp256k1 non-trivial endomorphism: lambda * (x, y) = (beta * x, y)"""
|
||||||
|
BETA = F(2)^((P-1)/3)
|
||||||
|
|
||||||
|
""" Lambda value of secp256k1 non-trivial endomorphism: lambda * (x, y) = (beta * x, y)"""
|
||||||
|
LAMBDA = Z(3)^((N-1)/3)
|
||||||
|
|
||||||
|
assert is_prime(P)
|
||||||
|
assert is_prime(N)
|
||||||
|
|
||||||
|
assert BETA != F(1)
|
||||||
|
assert BETA^3 == F(1)
|
||||||
|
|
||||||
|
assert LAMBDA != Z(1)
|
||||||
|
assert LAMBDA^3 == Z(1)
|
Loading…
x
Reference in New Issue
Block a user