isOnCurve method

bool isOnCurve()

Checks whether the point satisfies the BLS12-381 curve equation in projective form.

Implementation

bool isOnCurve() {
  // Y^2 * Z = X^3 + b * Z^3
  return (y.square() * z) ==
          (x.square() * x + z.square() * z * Bls12Fp.b()) ||
      z.isZero();
}