当前位置: 首页>>代码示例>>Java>>正文


Java ECConstants.ZERO属性代码示例

本文整理汇总了Java中org.bouncycastle.math.ec.ECConstants.ZERO属性的典型用法代码示例。如果您正苦于以下问题:Java ECConstants.ZERO属性的具体用法?Java ECConstants.ZERO怎么用?Java ECConstants.ZERO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bouncycastle.math.ec.ECConstants的用法示例。


在下文中一共展示了ECConstants.ZERO属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createParameters

protected X9ECParameters createParameters()
        {
            // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
            BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73");
            BigInteger a = ECConstants.ZERO;
            BigInteger b = BigInteger.valueOf(7);
            byte[] S = null;
            BigInteger n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3");
            BigInteger h = BigInteger.valueOf(1);

            ECCurve curve = new ECCurve.Fp(p, a, b);
//            ECPoint G = curve.decodePoint(Hex.decode("02"
//                + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"));
            ECPoint G = curve.decodePoint(Hex.decode("04"
                + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"
                + "938CF935318FDCED6BC28286531733C3F03C4FEE"));

            return new X9ECParameters(curve, G, n, h, S);
        }
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:SECNamedCurves.java

示例2: createParameters

protected X9ECParameters createParameters()
{
    int m = 233;
    int k = 74;

    BigInteger a = ECConstants.ZERO;
    BigInteger b = BigInteger.valueOf(1);
    byte[] S = null;
    BigInteger n = fromHex("8000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF");
    BigInteger h = BigInteger.valueOf(4);

    ECCurve curve = configureCurve(new ECCurve.F2m(m, k, a, b, n, h));
    //ECPoint G = curve.decodePoint(Hex.decode("02"
    //+ "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126"));
    X9ECPoint G = new X9ECPoint(curve, Hex.decode("04"
        + "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126"
        + "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3"));

    return new X9ECParameters(curve, G, n, h, S);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:20,代码来源:SECNamedCurves.java

示例3: createParameters

protected X9ECParameters createParameters()
{
    int m = 233;
    int k = 74;

    BigInteger a = ECConstants.ZERO;
    BigInteger b = BigInteger.valueOf(1);
    byte[] S = null;
    BigInteger n = fromHex("8000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF");
    BigInteger h = BigInteger.valueOf(4);

    ECCurve curve = configureCurve(new ECCurve.F2m(m, k, a, b, n, h));
    //ECPoint G = curve.decodePoint(Hex.decode("02"
    //+ "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126"));
    ECPoint G = curve.decodePoint(Hex.decode("04"
        + "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126"
        + "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3"));

    return new X9ECParameters(curve, G, n, h, S);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:20,代码来源:SECNamedCurves.java

示例4: createParameters

protected X9ECParameters createParameters()
        {
            // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1
            BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73");
            BigInteger a = ECConstants.ZERO;
            BigInteger b = BigInteger.valueOf(7);
            byte[] S = null;
            BigInteger n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3");
            BigInteger h = BigInteger.valueOf(1);

            ECCurve curve = configureCurve(new ECCurve.Fp(p, a, b));
//            ECPoint G = curve.decodePoint(Hex.decode("02"
//                + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"));
            ECPoint G = curve.decodePoint(Hex.decode("04"
                + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB"
                + "938CF935318FDCED6BC28286531733C3F03C4FEE"));

            return new X9ECParameters(curve, G, n, h, S);
        }
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:19,代码来源:SECNamedCurves.java

示例5: solveQuadradicEquation

/**
 * Solves a quadratic equation <code>z<sup>2</sup> + z = beta</code>(X9.62
 * D.1.6) The other solution is <code>z + 1</code>.
 *
 * @param beta The value to solve the qradratic equation for.
 * @return the solution for <code>z<sup>2</sup> + z = beta</code> or
 *         <code>null</code> if no solution exists.
 */
private static ECFieldElement solveQuadradicEquation(ECFieldElement beta)
{
    ECFieldElement.F2m b = (ECFieldElement.F2m)beta;
    ECFieldElement zeroElement = new ECFieldElement.F2m(
        b.getM(), b.getK1(), b.getK2(), b.getK3(), ECConstants.ZERO);

    if (beta.toBigInteger().equals(ECConstants.ZERO))
    {
        return zeroElement;
    }

    ECFieldElement z = null;
    ECFieldElement gamma = zeroElement;

    Random rand = new Random();
    int m = b.getM();
    do
    {
        ECFieldElement t = new ECFieldElement.F2m(b.getM(), b.getK1(),
            b.getK2(), b.getK3(), new BigInteger(m, rand));
        z = zeroElement;
        ECFieldElement w = beta;
        for (int i = 1; i <= m - 1; i++)
        {
            ECFieldElement w2 = w.square();
            z = z.square().add(w2.multiply(t));
            w = w2.add(beta);
        }
        if (!w.toBigInteger().equals(ECConstants.ZERO))
        {
            return null;
        }
        gamma = z.square().add(z);
    }
    while (gamma.toBigInteger().equals(ECConstants.ZERO));

    return z;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:46,代码来源:DSTU4145PointEncoder.java

示例6: extEuclidGLV

private static BigInteger[] extEuclidGLV(BigInteger n, BigInteger lambda)
{
    BigInteger r0 = n, r1 = lambda;
    // BigInteger s0 = ECConstants.ONE, s1 = ECConstants.ZERO;
    BigInteger t0 = ECConstants.ZERO, t1 = ECConstants.ONE;

    for (;;)
    {
        BigInteger[] qr = r0.divideAndRemainder(r1);
        BigInteger q = qr[0], r2 = qr[1];

        // BigInteger s2 = s0.subtract(q.multiply(s1));
        BigInteger t2 = t0.subtract(q.multiply(t1));

        if (isLessThanSqrt(r1, n))
        {
            return new BigInteger[]{ r0, t0, r1, t1, r2, t2 };
        }

        r0 = r1;
        r1 = r2;
        // s0 = s1;
        // s1 = s2;
        t0 = t1;
        t1 = t2;
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:27,代码来源:DiscoverEndomorphisms.java

示例7: extEuclidBezout

private static BigInteger[] extEuclidBezout(BigInteger[] ab)
{
    boolean swap = ab[0].compareTo(ab[1]) < 0;
    if (swap)
    {
        swap(ab);
    }

    BigInteger r0 = ab[0], r1 = ab[1];
    BigInteger s0 = ECConstants.ONE, s1 = ECConstants.ZERO;
    BigInteger t0 = ECConstants.ZERO, t1 = ECConstants.ONE;

    while (r1.compareTo(ECConstants.ONE) > 0)
    {
        BigInteger[] qr = r0.divideAndRemainder(r1);
        BigInteger q = qr[0], r2 = qr[1];

        BigInteger s2 = s0.subtract(q.multiply(s1));
        BigInteger t2 = t0.subtract(q.multiply(t1));

        r0 = r1;
        r1 = r2;
        s0 = s1;
        s1 = s2;
        t0 = t1;
        t1 = t2;
    }

    if (r1.signum() <= 0)
    {
        throw new IllegalStateException();
    }

    BigInteger[] st = new BigInteger[]{ s1, t1 };
    if (swap)
    {
        swap(st);
    }
    return st;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:40,代码来源:DiscoverEndomorphisms.java

示例8: extEuclidBezout

private static BigInteger[] extEuclidBezout(BigInteger[] ab)
{
    boolean swap = ab[0].compareTo(ab[1]) < 0;
    if (swap)
    {
        swap(ab);
    }

    BigInteger r0 = ab[0], r1 = ab[1];
    BigInteger s0 = ECConstants.ONE, s1 = ECConstants.ZERO;
    BigInteger t0 = ECConstants.ZERO, t1 = ECConstants.ONE;

    while (r1.compareTo(ECConstants.ONE) > 0)
    {
        BigInteger[] qr = r0.divideAndRemainder(r1);
        BigInteger q = qr[0], r2 = qr[1];

        BigInteger s2 = s0.subtract(q.multiply(s1));
        BigInteger t2 = t0.subtract(q.multiply(t1));

        r0 = r1;
        r1 = r2;
        s0 = s1;
        s1 = s2;
        t0 = t1;
        t1 = t2;
    }

    if (r1.signum() <= 0)
    {
        /*
         * NOTE: This case occurred while testing on curves over tiny fields; probably due to a 0 input.
         */
        return null;
    }

    BigInteger[] st = new BigInteger[]{ s1, t1 };
    if (swap)
    {
        swap(st);
    }
    return st;
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:43,代码来源:DiscoverEndomorphisms.java


注:本文中的org.bouncycastle.math.ec.ECConstants.ZERO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。