reduction().Error, then I run scrypt. ASAP.

asked 2023-02-23 07:19:50 +0100

Duglas gravatar image

updated 2023-02-26 14:26:54 +0100

FrédéricC gravatar image

Help me apply this function to secp256k1

reduction(p)

This finds the reduction of a point on the elliptic curve modulo the prime

p – a prime number

OUTPUT:

The point reduced to be a point on the elliptic curve modulo . .

INPUT: 11517998707 self – A point on an elliptic curve.

My code :

Error:

AttributeError: 'EllipticCurvePoint_finite_field' object has no attribute 'reduction'

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 point P

P = EC([115179987075229906903259602194857104773352008368264866291918996865985783521068, 90040672269639781867601170828097460642155183514693739441068299505511569496110])

Reduce point P mod 101

P_reduced = P.reduction(101)

print(P_reduced)

edit retag flag offensive close merge delete

Comments

I very sorry, for my bad message view. I post my message from phone,and very need you help. Thank you very much

Duglas gravatar imageDuglas ( 2023-02-23 07:35:58 +0100 )edit
3

The reduction method is defined only for number fields (not finite fields)

achrzesz gravatar imageachrzesz ( 2023-02-23 10:58:24 +0100 )edit