當前位置: 首頁>>代碼示例>>Java>>正文


Java Nat192類代碼示例

本文整理匯總了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;
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:19,代碼來源:SecT163Field.java

示例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);
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:16,代碼來源:SecT131FieldElement.java

示例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);
    }
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:13,代碼來源:SecP192K1Field.java

示例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);
    }
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:13,代碼來源:SecP192K1Field.java

示例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);
    }
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:8,代碼來源:SecP192K1FieldElement.java

示例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);
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:31,代碼來源:SecT131Field.java

示例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);
}
 
開發者ID:ttt43ttt,項目名稱:gwt-crypto,代碼行數:16,代碼來源:SecP192K1FieldElement.java

示例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);
    }
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:9,代碼來源:SecP192K1Field.java

示例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);
        }
    }
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:12,代碼來源:SecP192K1Field.java

示例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);
    }
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:9,代碼來源:SecP192K1FieldElement.java

示例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);
    }
 
開發者ID:ttt43ttt,項目名稱:gwt-crypto,代碼行數:9,代碼來源:SecP192R1FieldElement.java

示例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;
}
 
開發者ID:ttt43ttt,項目名稱:gwt-crypto,代碼行數:44,代碼來源:SecP192R1FieldElement.java

示例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);
        }
    }
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:15,代碼來源:SecT163Field.java

示例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);
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:12,代碼來源:SecT131FieldElement.java

示例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);
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:14,代碼來源:SecT131FieldElement.java


注:本文中的org.bouncycastle.math.raw.Nat192類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。