Help me apply this function to secp256k1
reduction(p)
This finds the reduction of a point on the elliptic curve modulo the prime .
INPUT: 11517998707 self – A point on an elliptic curve.
My code :
Not work:
Define point P
P = EC([115179987075229906903259602194857104773352008368264866291918996865985783521068, 90040672269639781867601170828097460642155183514693739441068299505511569496110])
Reduce point P mod 101
P_reduced = P.reduction(101)
print(P_reduced)
Error:
AttributeError: 'EllipticCurvePoint_finite_field' object has no attribute 'reduction'
p – a prime number
OUTPUT:
The point reduced to be a point on the elliptic curve modulo .
EXAMPLES:
E = EllipticCurve([1,2,3,4,0])
P = E(0,0)
P.reduction(5)
(0 : 0 : 1)
Q = E(98,931)
Q.reduction(5)
(3 : 1 : 1)
My code get error:
Define secp256k1 elliptic curve parameters
n = 115792089237316195423570985008687907852837564279074904382605163141518161494337
p256 = 2256 - 232 - 977
a256 = 0
b256 = 7
FF = GF(p256)
EC = EllipticCurve([FF(a256), FF(b256)])
EC.set_order(n)
Define secp256k1 elliptic curve parameters
n = 115792089237316195423570985008687907852837564279074904382605163141518161494337
p256 = 2256 - 232 - 977
a256 = 0
b256 = 7
FF = GF(p256)
EC = EllipticCurve([FF(a256), FF(b256)])
EC.set_order(n)