本文整理匯總了Java中org.bouncycastle.math.raw.Nat192類的典型用法代碼示例。如果您正苦於以下問題:Java Nat192類的具體用法?Java Nat192怎麽用?Java Nat192使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Nat192類屬於org.bouncycastle.math.raw包,在下文中一共展示了Nat192類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sqrt
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public static void sqrt(long[] x, long[] z)
{
long[] odd = Nat192.create64();
long u0, u1;
u0 = Interleave.unshuffle(x[0]); u1 = Interleave.unshuffle(x[1]);
long e0 = (u0 & 0x00000000FFFFFFFFL) | (u1 << 32);
odd[0] = (u0 >>> 32) | (u1 & 0xFFFFFFFF00000000L);
u0 = Interleave.unshuffle(x[2]);
long e1 = (u0 & 0x00000000FFFFFFFFL);
odd[1] = (u0 >>> 32);
multiply(odd, ROOT_Z, z);
z[0] ^= e0;
z[1] ^= e1;
}
示例2: equals
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public boolean equals(Object other)
{
if (other == this)
{
return true;
}
if (!(other instanceof SecT131FieldElement))
{
return false;
}
SecT131FieldElement o = (SecT131FieldElement)other;
return Nat192.eq64(x, o.x);
}
示例3: half
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public static void half(int[] x, int[] z)
{
if ((x[0] & 1) == 0)
{
Nat.shiftDownBit(6, x, 0, z);
}
else
{
int c = Nat192.add(x, P, z);
Nat.shiftDownBit(6, z, c);
}
}
示例4: reduce
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public static void reduce(int[] xx, int[] z)
{
long cc = Nat192.mul33Add(PInv33, xx, 6, xx, 0, z, 0);
int c = Nat192.mul33DWordAdd(PInv33, cc, z, 0);
// assert c == 0L || c == 1L;
if (c != 0 || (z[5] == P5 && Nat192.gte(z, P)))
{
Nat.add33To(6, PInv33, z);
}
}
示例5: invert
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public ECFieldElement invert()
{
// return new SecP192K1FieldElement(toBigInteger().modInverse(Q));
int[] z = Nat192.create();
Mod.invert(SecP192K1Field.P, x, z);
return new SecP192K1FieldElement(z);
}
示例6: invert
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public static void invert(long[] x, long[] z)
{
if (Nat192.isZero64(x))
{
throw new IllegalStateException();
}
// Itoh-Tsujii inversion
long[] t0 = Nat192.create64();
long[] t1 = Nat192.create64();
square(x, t0);
multiply(t0, x, t0);
squareN(t0, 2, t1);
multiply(t1, t0, t1);
squareN(t1, 4, t0);
multiply(t0, t1, t0);
squareN(t0, 8, t1);
multiply(t1, t0, t1);
squareN(t1, 16, t0);
multiply(t0, t1, t0);
squareN(t0, 32, t1);
multiply(t1, t0, t1);
square(t1, t1);
multiply(t1, x, t1);
squareN(t1, 65, t0);
multiply(t0, t1, t0);
square(t0, z);
}
示例7: equals
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public boolean equals(Object other)
{
if (other == this)
{
return true;
}
if (!(other instanceof SecP192K1FieldElement))
{
return false;
}
SecP192K1FieldElement o = (SecP192K1FieldElement)other;
return Nat192.eq(x, o.x);
}
示例8: reduce32
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public static void reduce32(int x, int[] z)
{
if ((x != 0 && Nat192.mul33WordAdd(PInv33, x, z, 0) != 0)
|| (z[5] == P5 && Nat192.gte(z, P)))
{
Nat.add33To(6, PInv33, z);
}
}
示例9: multiplyAddToExt
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public static void multiplyAddToExt(int[] x, int[] y, int[] zz)
{
int c = Nat192.mulAddTo(x, y, zz);
if (c != 0 || (zz[11] == PExt11 && Nat.gte(12, zz, PExt)))
{
if (Nat.addTo(PExtInv.length, PExtInv, zz) != 0)
{
Nat.incAt(12, zz, PExtInv.length);
}
}
}
示例10: divide
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public ECFieldElement divide(ECFieldElement b)
{
// return multiply(b.invert());
int[] z = Nat192.create();
Mod.invert(SecP192K1Field.P, ((SecP192K1FieldElement)b).x, z);
SecP192K1Field.multiply(z, x, z);
return new SecP192K1FieldElement(z);
}
示例11: divide
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public ECFieldElement divide(ECFieldElement b)
{
// return multiply(b.invert());
int[] z = Nat192.create();
Mod.invert(SecP192R1Field.P, ((SecP192R1FieldElement)b).x, z);
SecP192R1Field.multiply(z, x, z);
return new SecP192R1FieldElement(z);
}
示例12: sqrt
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
/**
* return a sqrt root - the routine verifies that the calculation returns the right value - if
* none exists it returns null.
*/
public ECFieldElement sqrt()
{
// Raise this element to the exponent 2^190 - 2^62
int[] x1 = this.x;
if (Nat192.isZero(x1) || Nat192.isOne(x1))
{
return this;
}
int[] t1 = Nat192.create();
int[] t2 = Nat192.create();
SecP192R1Field.square(x1, t1);
SecP192R1Field.multiply(t1, x1, t1);
SecP192R1Field.squareN(t1, 2, t2);
SecP192R1Field.multiply(t2, t1, t2);
SecP192R1Field.squareN(t2, 4, t1);
SecP192R1Field.multiply(t1, t2, t1);
SecP192R1Field.squareN(t1, 8, t2);
SecP192R1Field.multiply(t2, t1, t2);
SecP192R1Field.squareN(t2, 16, t1);
SecP192R1Field.multiply(t1, t2, t1);
SecP192R1Field.squareN(t1, 32, t2);
SecP192R1Field.multiply(t2, t1, t2);
SecP192R1Field.squareN(t2, 64, t1);
SecP192R1Field.multiply(t1, t2, t1);
SecP192R1Field.squareN(t1, 62, t1);
SecP192R1Field.square(t1, t2);
return Nat192.eq(x1, t2) ? new SecP192R1FieldElement(t1) : null;
}
示例13: squareN
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public static void squareN(long[] x, int n, long[] z)
{
// assert n > 0;
long[] tt = Nat192.createExt64();
implSquare(x, tt);
reduce(tt, z);
while (--n > 0)
{
implSquare(z, tt);
reduce(tt, z);
}
}
示例14: squarePow
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public ECFieldElement squarePow(int pow)
{
if (pow < 1)
{
return this;
}
long[] z = Nat192.create64();
SecT131Field.squareN(x, pow, z);
return new SecT131FieldElement(z);
}
示例15: squarePlusProduct
import org.bouncycastle.math.raw.Nat192; //導入依賴的package包/類
public ECFieldElement squarePlusProduct(ECFieldElement x, ECFieldElement y)
{
long[] ax = this.x;
long[] xx = ((SecT131FieldElement)x).x, yx = ((SecT131FieldElement)y).x;
long[] tt = Nat.create64(5);
SecT131Field.squareAddToExt(ax, tt);
SecT131Field.multiplyAddToExt(xx, yx, tt);
long[] z = Nat192.create64();
SecT131Field.reduce(tt, z);
return new SecT131FieldElement(z);
}