Java 8 ECPoint - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ECPoint class.

This code example shows how to use the following methods:
                ellipticCurve = EC5Util.convertCurve(curve, ecP.getSeed());
 
                ecSpec = new ECNamedCurveSpec(
                        ECUtil.getCurveName(oid),
                        ellipticCurve,
                        new ECPoint(
                                ecP.getG().getX().toBigInteger(),
                                ecP.getG().getY().toBigInteger()),
                        ecP.getN(),
                        ecP.getH());
            } 
            else if (params.isImplicitlyCA())
            { 
                ecSpec = null;
                curve = ProviderUtil.getEcImplicitlyCa().getCurve();
            } 
            else 
            { 
                X9ECParameters          ecP = new X9ECParameters((ASN1Sequence)params.getParameters());
 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getAffineX, getAffineY
    public static org.bouncycastle.math.ec.ECPoint convertPoint( 
        ECCurve curve,
        ECPoint point,
        boolean withCompression)
    { 
        return curve.createPoint(point.getAffineX(), point.getAffineY(), withCompression);
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:equals, getAffineX, getAffineY
        ECPoint out = new ECPoint(xOut, yOut);
        return out;
    } 
 
    private static ECPoint doublePoint(ECPoint r, EllipticCurve curve) {
        if (r.equals(ECPoint.POINT_INFINITY)) 
            return r;
        BigInteger slope = (r.getAffineX().pow(2)).multiply(THREE);
        slope = slope.add(curve.getA());
        BigInteger prime = ((ECFieldFp) curve.getField()).getP();
        slope = slope.multiply((r.getAffineY().multiply(TWO)).modInverse(prime));
        BigInteger xOut = slope.pow(2).subtract(r.getAffineX().multiply(TWO)).mod(prime);
        BigInteger yOut = (r.getAffineY().negate()).add(slope.multiply(r.getAffineX().subtract(xOut))).mod(prime);
        ECPoint out = new ECPoint(xOut, yOut);
        return out;
    } 
 
    /** 
     *  P-192 test only. 
     *  See KeyGenerator.main() for a test of all supported curves. 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getAffineX, getAffineY
    public static org.bouncycastle.math.ec.ECPoint convertPoint( 
        ECCurve curve,
        ECPoint point,
        boolean withCompression)
    { 
        return curve.createPoint(point.getAffineX(), point.getAffineY(), withCompression);
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            } 
        } 
         
        org.bouncycastle.math.ec.ECPoint p = c.decodePoint(encoded);
 
        return new ECPoint(p.getAffineXCoord().toBigInteger(), p.getAffineYCoord().toBigInteger());
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getAffineX, getAffineY
    public static org.bouncycastle.math.ec.ECPoint convertPoint( 
        ECCurve curve,
        ECPoint point,
        boolean withCompression)
    { 
        return curve.createPoint(point.getAffineX(), point.getAffineY(), withCompression);
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            BigInteger gxb = new NativeBigInteger(gxs.replace(" ", ""), 16);
            BigInteger gyb = new NativeBigInteger(gys.replace(" ", ""), 16);
            BigInteger ab = new NativeBigInteger(A.mod(pb));
            ECField field = new ECFieldFp(pb);
            EllipticCurve curve = new EllipticCurve(field, ab, bb, sb.toByteArray());
            ECPoint g = new ECPoint(gxb, gyb);
            return new ECParameterSpec(curve, g, nb, H);
        } 
    } 
 
    /* 
 
    D.1.2 Curves over Prime Fields 
 
    For each prime p, a pseudo-random curve 
    E : y**2 = x**3 -3x +b (mod p) 
    of prime order n is listed 4. (Thus, for these curves, the cofactor is always h = 1.) The following 
    parameters are given: 
 
    The selection a a = -3 for the coefficient of x was made for reasons of efficiency; see IEEE Std 1363-2000. 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     
    private static ECPoint convertPoint(
        org.bouncycastle.math.ec.ECPoint  g)
    { 
        g = g.normalize();
        return new ECPoint(g.getAffineXCoord().toBigInteger(), g.getAffineYCoord().toBigInteger());
    } 
     
    public ECNamedCurveSpec( 
        String                              name,
        ECCurve                             curve,
        org.bouncycastle.math.ec.ECPoint    g,
        BigInteger                          n)
    { 
        super(convertCurve(curve, null), convertPoint(g), n, 1);
 
        this.name = name;
    } 
 
    public ECNamedCurveSpec( 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:hashCode
     * 
     * Assertion: must return the same value if invoked 
     * repeatedly on the same object.  
     */ 
    public final void testHashCode01() { 
        ECPoint f = new ECPoint(BigInteger.valueOf(-23457L), BigInteger.ONE);
        int hc = f.hashCode();
        assertTrue(hc == f.hashCode() &&
                   hc == f.hashCode() &&
                   hc == f.hashCode() &&
                   hc == f.hashCode() &&
                   hc == f.hashCode() &&
                   hc == f.hashCode() &&
                   hc == f.hashCode() &&
                   hc == f.hashCode());
 
         
        // the same for POINT_INFINITY 
        hc = ECPoint.POINT_INFINITY.hashCode();
        assertTrue(hc == ECPoint.POINT_INFINITY.hashCode() &&
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:equals
        ECPoint p2=null, p1 =
            new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
        assertTrue(p1.equals(p1));
 
        // test case 2: equal objects 
        p1 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.ONE);
        p2 = new ECPoint(BigInteger.valueOf(-23456L), BigInteger.valueOf(1L));
        assertTrue(p1.equals(p2) && p2.equals(p1));
 
        // test case 3: equal POINT_INFINITY object(s) 
        p1 = ECPoint.POINT_INFINITY;
        p2 = ECPoint.POINT_INFINITY;
        assertTrue(p1.equals(p2) && p2.equals(p1));
    } 
 
    /** 
     * Test #2 for <code>equals(Object other)</code> method<br> 
     * Assertion: return false if this and other objects are not equal<br> 
     * Test preconditions: see test comments<br> 
     * Expected: all objects in this test must be not equal 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 ECPoint Methods: