static JacobianEcPoint toJacobianEcPoint(ECPoint p, BigInteger modulus) {
    if (p.equals(ECPoint.POINT_INFINITY)) {
      return JacobianEcPoint.INFINITY;
    }
    // Randomize the coordinates to get some protection against timing side channels.
    // Note that this randomization does not protect against all attacks, since it does not
    // randomize the value 0. A paper exploiting this is "Zero-Value Point Attacks on Elliptic Curve
    // Cryptosystem" by T. Akishita and T. Takagi
    // https://download.hrz.tu-darmstadt.de/pub/FB20/Dekanat/Publikationen/CDC/TI-03-01.zvp.pdf
    // A consequence of this paper is that this implementation should not be used for ECDH.
    BigInteger z = new BigInteger(1, Random.randBytes((modulus.bitLength() + 8) / 8)).mod(modulus);
    BigInteger zz = z.multiply(z).mod(modulus);
    BigInteger zzz = zz.multiply(z).mod(modulus);
    return new JacobianEcPoint(
        p.getAffineX().multiply(zz).mod(modulus), p.getAffineY().multiply(zzz).mod(modulus), z);
  }
Jacobian representation of elliptic curve points.

<p>The point (X, Y) is represented by a triple (x, y, z), where X = x/z^2 and Y = y/z^3.
java_src/src/main/java/com/google/crypto/tink/internal/EllipticCurvesUtil.java