本文整理汇总了Java中org.bouncycastle.math.raw.Nat224.create方法的典型用法代码示例。如果您正苦于以下问题:Java Nat224.create方法的具体用法?Java Nat224.create怎么用?Java Nat224.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.math.raw.Nat224
的用法示例。
在下文中一共展示了Nat224.create方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sqrt
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
/**
* return a sqrt root - the routine verifies that the calculation returns the right value - if
* none exists it returns null.
*/
public ECFieldElement sqrt()
{
int[] c = this.x;
if (Nat224.isZero(c) || Nat224.isOne(c))
{
return this;
}
int[] nc = Nat224.create();
SecP224R1Field.negate(c, nc);
int[] r = Mod.random(SecP224R1Field.P);
int[] t = Nat224.create();
if (!isSquare(c))
{
return null;
}
while (!trySqrt(nc, r, t))
{
SecP224R1Field.addOne(r, r);
}
SecP224R1Field.square(t, r);
return Nat224.eq(c, r) ? new SecP224R1FieldElement(t) : null;
}
示例2: trySqrt
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
private static boolean trySqrt(int[] nc, int[] r, int[] t)
{
int[] d1 = Nat224.create();
Nat224.copy(r, d1);
int[] e1 = Nat224.create();
e1[0] = 1;
int[] f1 = Nat224.create();
RP(nc, d1, e1, f1, t);
int[] d0 = Nat224.create();
int[] e0 = Nat224.create();
for (int k = 1; k < 96; ++k)
{
Nat224.copy(d1, d0);
Nat224.copy(e1, e0);
RS(d1, e1, f1, t);
if (Nat224.isZero(d1))
{
Mod.invert(SecP224R1Field.P, e0, t);
SecP224R1Field.multiply(t, d0, t);
return true;
}
}
return false;
}
示例3: divide
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement divide(ECFieldElement b)
{
// return multiply(b.invert());
int[] z = Nat224.create();
Mod.invert(SecP224K1Field.P, ((SecP224K1FieldElement)b).x, z);
SecP224K1Field.multiply(z, x, z);
return new SecP224K1FieldElement(z);
}
示例4: add
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement add(ECFieldElement b)
{
int[] z = Nat224.create();
SecP224K1Field.add(x, ((SecP224K1FieldElement)b).x, z);
return new SecP224K1FieldElement(z);
}
示例5: negate
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement negate()
{
int[] z = Nat224.create();
SecP224K1Field.negate(x, z);
return new SecP224K1FieldElement(z);
}
示例6: multiply
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement multiply(ECFieldElement b)
{
int[] z = Nat224.create();
SecP224K1Field.multiply(x, ((SecP224K1FieldElement)b).x, z);
return new SecP224K1FieldElement(z);
}
示例7: multiply
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement multiply(ECFieldElement b)
{
int[] z = Nat224.create();
SecP224R1Field.multiply(x, ((SecP224R1FieldElement)b).x, z);
return new SecP224R1FieldElement(z);
}
示例8: square
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement square()
{
int[] z = Nat224.create();
SecP224K1Field.square(x, z);
return new SecP224K1FieldElement(z);
}
示例9: negate
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement negate()
{
int[] z = Nat224.create();
SecP224R1Field.negate(x, z);
return new SecP224R1FieldElement(z);
}
示例10: twice
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECPoint twice()
{
if (this.isInfinity())
{
return this;
}
ECCurve curve = this.getCurve();
SecP224K1FieldElement Y1 = (SecP224K1FieldElement)this.y;
if (Y1.isZero())
{
return curve.getInfinity();
}
SecP224K1FieldElement X1 = (SecP224K1FieldElement)this.x, Z1 = (SecP224K1FieldElement)this.zs[0];
int c;
int[] Y1Squared = Nat224.create();
SecP224K1Field.square(Y1.x, Y1Squared);
int[] T = Nat224.create();
SecP224K1Field.square(Y1Squared, T);
int[] M = Nat224.create();
SecP224K1Field.square(X1.x, M);
c = Nat224.addBothTo(M, M, M);
SecP224K1Field.reduce32(c, M);
int[] S = Y1Squared;
SecP224K1Field.multiply(Y1Squared, X1.x, S);
c = Nat.shiftUpBits(7, S, 2, 0);
SecP224K1Field.reduce32(c, S);
int[] t1 = Nat224.create();
c = Nat.shiftUpBits(7, T, 3, 0, t1);
SecP224K1Field.reduce32(c, t1);
SecP224K1FieldElement X3 = new SecP224K1FieldElement(T);
SecP224K1Field.square(M, X3.x);
SecP224K1Field.subtract(X3.x, S, X3.x);
SecP224K1Field.subtract(X3.x, S, X3.x);
SecP224K1FieldElement Y3 = new SecP224K1FieldElement(S);
SecP224K1Field.subtract(S, X3.x, Y3.x);
SecP224K1Field.multiply(Y3.x, M, Y3.x);
SecP224K1Field.subtract(Y3.x, t1, Y3.x);
SecP224K1FieldElement Z3 = new SecP224K1FieldElement(M);
SecP224K1Field.twice(Y1.x, Z3.x);
if (!Z1.isOne())
{
SecP224K1Field.multiply(Z3.x, Z1.x, Z3.x);
}
return new SecP224K1Point(curve, X3, Y3, new ECFieldElement[] { Z3 }, this.withCompression);
}
示例11: addOne
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement addOne()
{
int[] z = Nat224.create();
SecP224R1Field.addOne(x, z);
return new SecP224R1FieldElement(z);
}
示例12: twice
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECPoint twice()
{
if (this.isInfinity())
{
return this;
}
ECCurve curve = this.getCurve();
SecP224R1FieldElement Y1 = (SecP224R1FieldElement)this.y;
if (Y1.isZero())
{
return curve.getInfinity();
}
SecP224R1FieldElement X1 = (SecP224R1FieldElement)this.x, Z1 = (SecP224R1FieldElement)this.zs[0];
int c;
int[] t1 = Nat224.create();
int[] t2 = Nat224.create();
int[] Y1Squared = Nat224.create();
SecP224R1Field.square(Y1.x, Y1Squared);
int[] T = Nat224.create();
SecP224R1Field.square(Y1Squared, T);
boolean Z1IsOne = Z1.isOne();
int[] Z1Squared = Z1.x;
if (!Z1IsOne)
{
Z1Squared = t2;
SecP224R1Field.square(Z1.x, Z1Squared);
}
SecP224R1Field.subtract(X1.x, Z1Squared, t1);
int[] M = t2;
SecP224R1Field.add(X1.x, Z1Squared, M);
SecP224R1Field.multiply(M, t1, M);
c = Nat224.addBothTo(M, M, M);
SecP224R1Field.reduce32(c, M);
int[] S = Y1Squared;
SecP224R1Field.multiply(Y1Squared, X1.x, S);
c = Nat.shiftUpBits(7, S, 2, 0);
SecP224R1Field.reduce32(c, S);
c = Nat.shiftUpBits(7, T, 3, 0, t1);
SecP224R1Field.reduce32(c, t1);
SecP224R1FieldElement X3 = new SecP224R1FieldElement(T);
SecP224R1Field.square(M, X3.x);
SecP224R1Field.subtract(X3.x, S, X3.x);
SecP224R1Field.subtract(X3.x, S, X3.x);
SecP224R1FieldElement Y3 = new SecP224R1FieldElement(S);
SecP224R1Field.subtract(S, X3.x, Y3.x);
SecP224R1Field.multiply(Y3.x, M, Y3.x);
SecP224R1Field.subtract(Y3.x, t1, Y3.x);
SecP224R1FieldElement Z3 = new SecP224R1FieldElement(M);
SecP224R1Field.twice(Y1.x, Z3.x);
if (!Z1IsOne)
{
SecP224R1Field.multiply(Z3.x, Z1.x, Z3.x);
}
return new SecP224R1Point(curve, X3, Y3, new ECFieldElement[]{ Z3 }, this.withCompression);
}
示例13: subtract
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement subtract(ECFieldElement b)
{
int[] z = Nat224.create();
SecP224K1Field.subtract(x, ((SecP224K1FieldElement)b).x, z);
return new SecP224K1FieldElement(z);
}
示例14: subtract
import org.bouncycastle.math.raw.Nat224; //导入方法依赖的package包/类
public ECFieldElement subtract(ECFieldElement b)
{
int[] z = Nat224.create();
SecP224R1Field.subtract(x, ((SecP224R1FieldElement)b).x, z);
return new SecP224R1FieldElement(z);
}