Java 8 ECFieldFp - 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 ECFieldFp class.

This code example shows how to use the following methods:equals
     * Test #1 for <code>equals()</code> method.<br> 
     * 
     * Assertion: object equals to itself.  
     */ 
    public final void testEqualsObject01() { 
        ECFieldFp obj = new ECFieldFp(BigInteger.valueOf(23L));
        assertTrue(obj.equals(obj));
    } 
 
    /** 
     * Test #2 for <code>equals(Object obj)</code> method.<br> 
     * 
     * Assertion: returns false if <code>obj</code> is <code>null</code> 
     */ 
    public final void testEqualsObject02() { 
        assertFalse(new ECFieldFp(BigInteger.valueOf(23L)).equals(null));
    } 
 
    /** 
     * Test #3 for <code>equals(Object obj)</code> method.<br> 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        ECCurve  curve,
        byte[]   seed)
    { 
        if (ECAlgorithms.isFpCurve(curve))
        { 
            return new EllipticCurve(new ECFieldFp(curve.getField().getCharacteristic()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed);
        } 
        else 
        { 
            ECCurve.F2m curveF2m = (ECCurve.F2m)curve;
            int ks[];
             
            if (curveF2m.isTrinomial())
            { 
                ks = new int[] { curveF2m.getK1() };
                 
                return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), seed);
            } 
            else 
            { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    { 
        // TODO: the Sun EC implementation doesn't currently handle the seed properly 
        // so at the moment it's set to null. Should probably look at making this configurable 
        if (ECAlgorithms.isFpCurve(curve))
        { 
            return new EllipticCurve(new ECFieldFp(curve.getField().getCharacteristic()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
        } 
        else 
        { 
            ECCurve.F2m curveF2m = (ECCurve.F2m)curve;
            int ks[];
             
            if (curveF2m.isTrinomial())
            { 
                ks = new int[] { curveF2m.getK1() };
                 
                return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
            } 
            else 
            { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        X9ECParameters x9ECParameters = NISTNamedCurves.getByName("P-192");
        ECCurve curve = x9ECParameters.getCurve();
 
        ECPrivateKeySpec privKeySpec = new ECPrivateKeySpec(new BigInteger("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16),
            new ECParameterSpec(
                new EllipticCurve(new ECFieldFp(((ECCurve.Fp)curve).getQ()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null),
                new ECPoint(x9ECParameters.getG().getXCoord().toBigInteger(), x9ECParameters.getG().getYCoord().toBigInteger()),
                x9ECParameters.getN(), x9ECParameters.getH().intValue())
            ); 
 
        KeyFactory keyFact = KeyFactory.getInstance("ECDSA", "BC");
 
        PrivateKey privKey = keyFact.generatePrivate(privKeySpec);
 
        doTestHMACDetECDSASample("SHA1withDETECDSA", privKey,   new BigInteger("98C6BD12B23EAF5E2A2045132086BE3EB8EBD62ABF6698FF", 16), new BigInteger("57A22B07DEA9530F8DE9471B1DC6624472E8E2844BC25B64", 16));
        doTestHMACDetECDSASample("SHA224withDETECDSA", privKey, new BigInteger("A1F00DAD97AEEC91C95585F36200C65F3C01812AA60378F5", 16), new BigInteger("E07EC1304C7C6C9DEBBE980B9692668F81D4DE7922A0F97A", 16));
        doTestHMACDetECDSASample("SHA256withDETECDSA", privKey, new BigInteger("4B0B8CE98A92866A2820E20AA6B75B56382E0F9BFD5ECB55", 16), new BigInteger("CCDB006926EA9565CBADC840829D8C384E06DE1F1E381B85", 16));
        doTestHMACDetECDSASample("SHA384withDETECDSA", privKey, new BigInteger("DA63BF0B9ABCF948FBB1E9167F136145F7A20426DCC287D5", 16), new BigInteger("C3AA2C960972BD7A2003A57E1C4C77F0578F8AE95E31EC5E", 16));
        doTestHMACDetECDSASample("SHA512withDETECDSA", privKey, new BigInteger("4D60C5AB1996BD848343B31C00850205E2EA6922DAC2E4B8", 16), new BigInteger("3F6E837448F027A1BF4B34E796E32A811CBB4050908D8F67", 16));
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:equals
     * Test #1 for <code>equals()</code> method.<br> 
     * 
     * Assertion: object equals to itself. 
     */ 
    public final void testEqualsObject01() { 
        ECFieldFp obj = new ECFieldFp(BigInteger.valueOf(23L));
        assertTrue(obj.equals(obj));
    } 
 
    /** 
     * Test #2 for <code>equals(Object obj)</code> method.<br> 
     * 
     * Assertion: returns false if <code>obj</code> is <code>null</code> 
     */ 
    public final void testEqualsObject02() { 
        assertFalse(new ECFieldFp(BigInteger.valueOf(23L)).equals(null));
    } 
 
    /** 
     * Test #3 for <code>equals(Object obj)</code> method.<br> 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            BigInteger sb = new NativeBigInteger(ss.replace(" ", ""), 16);
            BigInteger bb = new NativeBigInteger(bs.replace(" ", ""), 16);
            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: 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * Test preconditions: valid parameters passed<br> 
     * Expected: must pass without any exceptions 
     */ 
    public final void testEllipticCurveECFieldBigIntegerBigIntegerbyteArray01() { 
        // test case 1 parameters set 
        ECFieldFp f = new ECFieldFp(BigInteger.valueOf(23L));
        BigInteger a = BigInteger.ONE;
        BigInteger b = BigInteger.valueOf(19L);
        byte[] seed = new byte[24];
        // perform test case 1 
        new EllipticCurve(f, a, b, seed);
 
        // test case 2 parameters set 
        ECFieldF2m f1 = new ECFieldF2m(5);
        a = BigInteger.ZERO;
        b = BigInteger.valueOf(23L);
        // perform test case 2 
        new EllipticCurve(f1, a, b, seed);
 
        // test case 3 parameters set, 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		Security.addProvider(new BouncyCastleProvider());
 
		BigInteger p = new BigInteger(
				"883423532389192164791648750360308885314476597252960362792450860609699839"); 
  
		ECFieldFp ecFieldFp = new ECFieldFp(p);
 
		BigInteger a = new BigInteger(
				"7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 
				16); 
  
		BigInteger b = new BigInteger(
				"6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 
				16); 
  
		EllipticCurve ellipticCurve = new EllipticCurve(ecFieldFp, a, b);
 
		BigInteger x = new BigInteger(
				"110282003749548856476348533541186204577905061504881242240149511594420911"); 
  
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * Expected: must pass without any exceptions 
     */ 
    public final void testECParameterSpec01() { 
        // Valid (see note below) parameters set 
        EllipticCurve c =
            new EllipticCurve(new ECFieldFp(BigInteger.valueOf(5L)),
                              BigInteger.ZERO,
                              BigInteger.valueOf(4L));
        ECPoint g = new ECPoint(BigInteger.ZERO, BigInteger.valueOf(2L));
        new ECParameterSpec(c, g, BigInteger.valueOf(5L), 10);        
    } 
 
    /** 
     * Test #2 for <code>ECParameterSpec(EllipticCurve, ECPoint, BigInteger, int)</code> constructor<br>  
     * Assertion: throws <code>NullPointerException</code> if 
     * <code>curve</code>, <code>generator</code> or <code>order</code> is <code>null</code><br> 
     * Test preconditions: pass <code>null</code> as mentioned parameters<br> 
     * Expected: must throw <code>NullPointerException</code> 
     */ 
    public final void testECParameterSpec02() { 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    { 
        // TODO: the Sun EC implementation doesn't currently handle the seed properly 
        // so at the moment it's set to null. Should probably look at making this configurable 
        if (curve instanceof ECCurve.Fp)
        { 
            return new EllipticCurve(new ECFieldFp(((ECCurve.Fp)curve).getQ()), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
        } 
        else 
        { 
            ECCurve.F2m curveF2m = (ECCurve.F2m)curve;
            int ks[];
             
            if (curveF2m.isTrinomial())
            { 
                ks = new int[] { curveF2m.getK1() };
                 
                return new EllipticCurve(new ECFieldF2m(curveF2m.getM(), ks), curve.getA().toBigInteger(), curve.getB().toBigInteger(), null);
            } 
            else 
            { 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 ECFieldFp Methods: