forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move curve parameters to separate file * Rename main prover script for clarity
- Loading branch information
1 parent
13c88ef
commit f554dfc
Showing
3 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |