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


Java ECFieldElement.isZero方法代码示例

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


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

示例1: twicePlus

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint twicePlus(ECPoint b)
{
    if (this == b)
    {
        return threeTimes();
    }
    if (this.isInfinity())
    {
        return b;
    }
    if (b.isInfinity())
    {
        return twice();
    }

    ECFieldElement Y1 = this.y;
    if (Y1.isZero())
    {
        return b;
    }

    return twice().add(b);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:24,代码来源:SecP160R2Point.java

示例2: negate

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint negate()
{
    if (this.isInfinity())
    {
        return this;
    }

    ECFieldElement X = this.x;
    if (X.isZero())
    {
        return this;
    }

    // L is actually Lambda (X + Y/X) here
    ECFieldElement L = this.y, Z = this.zs[0];
    return new SecT163K1Point(curve, X, L.add(Z), new ECFieldElement[]{ Z }, this.withCompression);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:18,代码来源:SecT163K1Point.java

示例3: negate

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint negate()
{
    if (this.isInfinity())
    {
        return this;
    }

    ECFieldElement X = this.x;
    if (X.isZero())
    {
        return this;
    }

    // L is actually Lambda (X + Y/X) here
    ECFieldElement L = this.y, Z = this.zs[0];
    return new SecT193R1Point(curve, X, L.add(Z), new ECFieldElement[]{ Z }, this.withCompression);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:18,代码来源:SecT193R1Point.java

示例4: twice

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint twice()
{
    if (this.isInfinity())
    {
        return this;
    }

    ECCurve curve = this.getCurve();

    ECFieldElement Y1 = this.y;
    if (Y1.isZero()) 
    {
        return curve.getInfinity();
    }

    return twiceJacobianModified(true);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:18,代码来源:Curve25519Point.java

示例5: negate

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint negate()
{
    if (this.isInfinity())
    {
        return this;
    }

    ECFieldElement X = this.x;
    if (X.isZero())
    {
        return this;
    }

    // L is actually Lambda (X + Y/X) here
    ECFieldElement L = this.y, Z = this.zs[0];
    return new SecT193R2Point(curve, X, L.add(Z), new ECFieldElement[]{ Z }, this.withCompression);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:18,代码来源:SecT193R2Point.java

示例6: negate

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint negate()
{
    if (this.isInfinity())
    {
        return this;
    }

    ECFieldElement X = this.x;
    if (X.isZero())
    {
        return this;
    }

    // L is actually Lambda (X + Y/X) here
    ECFieldElement L = this.y, Z = this.zs[0];
    return new SecT283R1Point(curve, X, L.add(Z), new ECFieldElement[]{ Z }, this.withCompression);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:18,代码来源:SecT283R1Point.java

示例7: negate

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint negate()
{
    if (this.isInfinity())
    {
        return this;
    }

    ECFieldElement X = this.x;
    if (X.isZero())
    {
        return this;
    }

    // L is actually Lambda (X + Y/X) here
    ECFieldElement L = this.y, Z = this.zs[0];
    return new SecT571K1Point(curve, X, L.add(Z), new ECFieldElement[]{ Z }, this.withCompression);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:18,代码来源:SecT571K1Point.java

示例8: negate

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint negate()
{
    if (this.isInfinity())
    {
        return this;
    }

    ECFieldElement X = this.x;
    if (X.isZero())
    {
        return this;
    }

    // L is actually Lambda (X + Y/X) here
    ECFieldElement L = this.y, Z = this.zs[0];
    return new SecT113R2Point(curve, X, L.add(Z), new ECFieldElement[]{ Z }, this.withCompression);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:18,代码来源:SecT113R2Point.java

示例9: getCompressionYTilde

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
protected boolean getCompressionYTilde()
{
    ECFieldElement X = this.getRawXCoord();
    if (X.isZero())
    {
        return false;
    }

    ECFieldElement Y = this.getRawYCoord();

    // Y is actually Lambda (X + Y/X) here
    return Y.testBitZero() != X.testBitZero();
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:14,代码来源:SecT283R1Point.java

示例10: solveQuadraticEquation

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
/**
 * 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 quadratic 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 solveQuadraticEquation(ECCurve curve, ECFieldElement beta)
{
    if (beta.isZero())
    {
        return beta;
    }

    ECFieldElement zeroElement = curve.fromBigInteger(ECConstants.ZERO);

    ECFieldElement z = null;
    ECFieldElement gamma = null;

    Random rand = new Random();
    int m = beta.getFieldSize();
    do
    {
        ECFieldElement t = curve.fromBigInteger(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.isZero())
        {
            return null;
        }
        gamma = z.square().add(z);
    }
    while (gamma.isZero());

    return z;
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:44,代码来源:DSTU4145PointEncoder.java

示例11: twice

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint twice()
{
    if (this.isInfinity())
    {
        return this;
    }

    ECCurve curve = this.getCurve();

    ECFieldElement X1 = this.x;
    if (X1.isZero())
    {
        // A point with X == 0 is it's own additive inverse
        return curve.getInfinity();
    }

    ECFieldElement L1 = this.y, Z1 = this.zs[0];

    boolean Z1IsOne = Z1.isOne();
    ECFieldElement L1Z1 = Z1IsOne ? L1 : L1.multiply(Z1);
    ECFieldElement Z1Sq = Z1IsOne ? Z1 : Z1.square();
    ECFieldElement T = L1.square().add(L1Z1).add(Z1Sq);
    if (T.isZero())
    {
        return new SecT233R1Point(curve, T, curve.getB().sqrt(), withCompression);
    }

    ECFieldElement X3 = T.square();
    ECFieldElement Z3 = Z1IsOne ? T : T.multiply(Z1Sq);

    ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.multiply(Z1);
    ECFieldElement L3 = X1Z1.squarePlusProduct(T, L1Z1).add(X3).add(Z3);

    return new SecT233R1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, this.withCompression);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:36,代码来源:SecT233R1Point.java

示例12: twicePlus

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint twicePlus(ECPoint b)
    {
        if (this.isInfinity())
        {
            return b;
        }
        if (b.isInfinity())
        {
            return twice();
        }

        ECCurve curve = this.getCurve();

        ECFieldElement X1 = this.x;
        if (X1.isZero())
        {
            // A point with X == 0 is it's own additive inverse
            return b;
        }

        ECFieldElement X2 = b.getRawXCoord(), Z2 = b.getZCoord(0);
        if (X2.isZero() || !Z2.isOne())
        {
            return twice().add(b);
        }

        ECFieldElement L1 = this.y, Z1 = this.zs[0];
        ECFieldElement L2 = b.getRawYCoord();

        ECFieldElement X1Sq = X1.square();
        ECFieldElement L1Sq = L1.square();
        ECFieldElement Z1Sq = Z1.square();
        ECFieldElement L1Z1 = L1.multiply(Z1);

//        ECFieldElement T = curve.getA().multiply(Z1Sq).add(L1Sq).add(L1Z1);
        ECFieldElement T = Z1Sq.add(L1Sq).add(L1Z1);
        ECFieldElement L2plus1 = L2.addOne();
//        ECFieldElement A = curve.getA().add(L2plus1).multiply(Z1Sq).add(L1Sq).multiplyPlusProduct(T, X1Sq, Z1Sq);
        ECFieldElement A = L2.multiply(Z1Sq).add(L1Sq).multiplyPlusProduct(T, X1Sq, Z1Sq);
        ECFieldElement X2Z1Sq = X2.multiply(Z1Sq);
        ECFieldElement B = X2Z1Sq.add(T).square();

        if (B.isZero())
        {
            if (A.isZero())
            {
                return b.twice();
            }

            return curve.getInfinity();
        }

        if (A.isZero())
        {
            return new SecT163R2Point(curve, A, curve.getB().sqrt(), withCompression);
        }

        ECFieldElement X3 = A.square().multiply(X2Z1Sq);
        ECFieldElement Z3 = A.multiply(B).multiply(Z1Sq);
        ECFieldElement L3 = A.add(B).square().multiplyPlusProduct(T, L2plus1, Z3);

        return new SecT163R2Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, this.withCompression);
    }
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:64,代码来源:SecT163R2Point.java

示例13: twicePlus

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint twicePlus(ECPoint b)
    {
        if (this.isInfinity())
        {
            return b;
        }
        if (b.isInfinity())
        {
            return twice();
        }

        ECCurve curve = this.getCurve();

        ECFieldElement X1 = this.x;
        if (X1.isZero())
        {
            // A point with X == 0 is it's own additive inverse
            return b;
        }

        // NOTE: twicePlus() only optimized for lambda-affine argument
        ECFieldElement X2 = b.getRawXCoord(), Z2 = b.getZCoord(0);
        if (X2.isZero() || !Z2.isOne())
        {
            return twice().add(b);
        }

        ECFieldElement L1 = this.y, Z1 = this.zs[0];
        ECFieldElement L2 = b.getRawYCoord();

        ECFieldElement X1Sq = X1.square();
        ECFieldElement L1Sq = L1.square();
        ECFieldElement Z1Sq = Z1.square();
        ECFieldElement L1Z1 = L1.multiply(Z1);

//        ECFieldElement T = curve.getA().multiply(Z1Sq).add(L1Sq).add(L1Z1);
        ECFieldElement T = L1Sq.add(L1Z1);
        ECFieldElement L2plus1 = L2.addOne();
//        ECFieldElement A = curve.getA().add(L2plus1).multiply(Z1Sq).add(L1Sq).multiplyPlusProduct(T, X1Sq, Z1Sq);
        ECFieldElement A = L2plus1.multiply(Z1Sq).add(L1Sq).multiplyPlusProduct(T, X1Sq, Z1Sq);
        ECFieldElement X2Z1Sq = X2.multiply(Z1Sq);
        ECFieldElement B = X2Z1Sq.add(T).square();

        if (B.isZero())
        {
            if (A.isZero())
            {
                return b.twice();
            }

            return curve.getInfinity();
        }

        if (A.isZero())
        {
//            return new SecT239K1Point(curve, A, curve.getB().sqrt(), withCompression);
            return new SecT239K1Point(curve, A, curve.getB(), withCompression);
        }

        ECFieldElement X3 = A.square().multiply(X2Z1Sq);
        ECFieldElement Z3 = A.multiply(B).multiply(Z1Sq);
        ECFieldElement L3 = A.add(B).square().multiplyPlusProduct(T, L2plus1, Z3);

        return new SecT239K1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, this.withCompression);
    }
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:66,代码来源:SecT239K1Point.java

示例14: twice

import org.bouncycastle.math.ec.ECFieldElement; //导入方法依赖的package包/类
public ECPoint twice()
    {
        if (this.isInfinity())
        {
            return this;
        }

        ECCurve curve = this.getCurve();

        ECFieldElement X1 = this.x;
        if (X1.isZero())
        {
            // A point with X == 0 is it's own additive inverse
            return curve.getInfinity();
        }


        ECFieldElement L1 = this.y, Z1 = this.zs[0];

        boolean Z1IsOne = Z1.isOne();
        ECFieldElement Z1Sq = Z1IsOne ? Z1 : Z1.square();
        ECFieldElement T;
        if (Z1IsOne)
        {
            T = L1.square().add(L1);
        }
        else
        {
            T = L1.add(Z1).multiply(L1);
        }

        if (T.isZero())
        {
//            return new SecT283K1Point(curve, T, curve.getB().sqrt(), withCompression);
            return new SecT283K1Point(curve, T, curve.getB(), withCompression);
        }

        ECFieldElement X3 = T.square();
        ECFieldElement Z3 = Z1IsOne ? T : T.multiply(Z1Sq);

        ECFieldElement t1 = L1.add(X1).square();
        ECFieldElement t2 = Z1IsOne ? Z1 : Z1Sq.square();
        ECFieldElement L3 = t1.add(T).add(Z1Sq).multiply(t1).add(t2).add(X3).add(Z3);

        return new SecT283K1Point(curve, X3, L3, new ECFieldElement[]{ Z3 }, this.withCompression);
    }
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:47,代码来源:SecT283K1Point.java


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