0
I have this bitcoin curve:
y^2 = x^3 + 7
but the finite field Fp is modified to be:
n=115792089237316195423570985008687907853269984665640564039457584007908834675927
1-What is the G point?
2-how to get the Y coordinate for any X value?
I'm using this C# code to get Y from X but it works with original bitcoin curve only.
public BigInteger mod(BigInteger num, BigInteger by) {
BigInteger res = num % by;
if (res < 0) { res += by; }
return res;
}
public BigInteger EC_GetY(BigInteger x, bool modIt, BigInteger n) {
BigInteger n_OVER_FOUR = (n + 1) / 4;
BigInteger alpha = mod(BigInteger.Pow(x, 3) + 7, n);
BigInteger beta = BigInteger.ModPow(alpha, n_OVER_FOUR, n);//SqRtN
BigInteger Y = beta;
if (!modIt) { return Y; }
Y = n - beta;
return Y;
}
you did not understand my question, because
N is already a prime number ,,
y^2 = x^3 + 7 => y = modsqrt(x^3 + 7) ,,
i said that i did this but not work with my new N – remon78eg – 2018-11-15T12:20:39.330
yes,any point can be a generator point, but when i choose any x and find its y to be G point,and then add this G point to itself, i get another x,y then when i test y by getting y from x, it not be the same. – remon78eg – 2018-11-15T12:49:12.390
Then your code is wrong. What algorithm are you trying to implement? Where does (n-1)/4 come from? – Mike D – 2018-11-15T20:36:05.703
@MikeD OP is using "N" to refer to the field size, not the curve order. – Pieter Wuille – 2018-11-16T01:41:11.847
@MikeD x^((n-1)/4) is a way to compute the modular square root, when the field size p satsifies (p mod 4) = 3, which is the case for OP's field. – Pieter Wuille – 2018-11-16T02:08:42.660
@Pieter Wuille, yes, true. – remon78eg – 2018-11-16T10:18:20.477