I'm currently trying to simulate a message mapping on elliptic curve, and I am trying to find a point on the curve y**2 = (x**3 + a*x + b) % p
, by setting the x variable as hexadecimal converted string.
However, I don't know whether it's the problem with my implementation or a glitch in the program, but the result is completely different from what I am expecting.
// variables
b = 2455155546008943817740293915197451784769108058161191238065
a = -3
x = 1894290318373708250692331360974342813437992324945519136769
p = 6277101735386680763835789423176059013767194773182842284081
//square root of y to its 4th power
y = (x**3 + a*x + b) % p
y = y ** .5
(y ** 4 - 1 ** 3 - a * x - b) % p
//y itself to its 2nd power
y = (x**3 + a*x + b) % p
y = y
(y ** 2 - 1 ** 3 - a * x - b) % p
For the square root of y to its 4th power, the result turns out to be 0.0
, whereas the result for y itself to its 2nd power gives the result 4575606179561504294120638508707052089783083374310823885174
. Could anyone please explain to me either what is going on or what I'm doing wrong?
Thank you.