liftX static method
Implementation
static BigInt liftX(BigInt x) {
if (x >= curveP) {
throw Error();
}
var ySq = (x.modPow(BigInt.from(3), curveP) + BigInt.from(7)) % curveP;
var y = ySq.modPow((curveP + BigInt.one) ~/ BigInt.from(4), curveP);
if (y.modPow(BigInt.two, curveP) != ySq) {
throw Error();
}
return y % BigInt.two == BigInt.zero /* even */ ? y : curveP - y;
}