• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Pack类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bouncycastle.util.Pack的典型用法代码示例。如果您正苦于以下问题:Java Pack类的具体用法?Java Pack怎么用?Java Pack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: restoreState

import org.bouncycastle.util.Pack; //导入依赖的package包/类
protected void restoreState(byte[] encodedState)
{
    xBufOff = Pack.bigEndianToInt(encodedState, 8);
    System.arraycopy(encodedState, 0, xBuf, 0, xBufOff);
    byteCount1 = Pack.bigEndianToLong(encodedState, 12);
    byteCount2 = Pack.bigEndianToLong(encodedState, 20);

    H1 = Pack.bigEndianToLong(encodedState, 28);
    H2 = Pack.bigEndianToLong(encodedState, 36);
    H3 = Pack.bigEndianToLong(encodedState, 44);
    H4 = Pack.bigEndianToLong(encodedState, 52);
    H5 = Pack.bigEndianToLong(encodedState, 60);
    H6 = Pack.bigEndianToLong(encodedState, 68);
    H7 = Pack.bigEndianToLong(encodedState, 76);
    H8 = Pack.bigEndianToLong(encodedState, 84);

    wOff = Pack.bigEndianToInt(encodedState, 92);
    for (int i = 0; i < wOff; i++)
    {
        W[i] = Pack.bigEndianToLong(encodedState, 96 + (i * 8));
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:23,代码来源:LongDigest.java


示例2: getEncodedState

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public byte[] getEncodedState()
{
    byte[] state = new byte[40 + xOff * 4];

    super.populateState(state);

    Pack.intToBigEndian(H1, state, 16);
    Pack.intToBigEndian(H2, state, 20);
    Pack.intToBigEndian(H3, state, 24);
    Pack.intToBigEndian(H4, state, 28);
    Pack.intToBigEndian(H5, state, 32);
    Pack.intToBigEndian(xOff, state, 36);

    for (int i = 0; i != xOff; i++)
    {
        Pack.intToBigEndian(X[i], state, 40 + (i * 4));
    }

    return state;
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:21,代码来源:SHA1Digest.java


示例3: doFinal

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public int doFinal(
    byte[]  out,
    int     outOff)
{
    finish();

    Pack.intToBigEndian(H1, out, outOff);
    Pack.intToBigEndian(H2, out, outOff + 4);
    Pack.intToBigEndian(H3, out, outOff + 8);
    Pack.intToBigEndian(H4, out, outOff + 12);
    Pack.intToBigEndian(H5, out, outOff + 16);

    reset();

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


示例4: SHA224Digest

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public SHA224Digest(byte[] encodedState)
{
    super(encodedState);

    H1 = Pack.bigEndianToInt(encodedState, 16);
    H2 = Pack.bigEndianToInt(encodedState, 20);
    H3 = Pack.bigEndianToInt(encodedState, 24);
    H4 = Pack.bigEndianToInt(encodedState, 28);
    H5 = Pack.bigEndianToInt(encodedState, 32);
    H6 = Pack.bigEndianToInt(encodedState, 36);
    H7 = Pack.bigEndianToInt(encodedState, 40);
    H8 = Pack.bigEndianToInt(encodedState, 44);

    xOff = Pack.bigEndianToInt(encodedState, 48);
    for (int i = 0; i != xOff; i++)
    {
        X[i] = Pack.bigEndianToInt(encodedState, 52 + (i * 4));
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:20,代码来源:SHA224Digest.java


示例5: generateBytes

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public int generateBytes(byte[] out, int outOff, int len)
    throws DataLengthException, IllegalArgumentException
{
    // TODO Create an ASN.1 class for this (RFC3278)
    // ECC-CMS-SharedInfo
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(new AlgorithmIdentifier(algorithm, DERNull.INSTANCE));
    v.add(new DERTaggedObject(true, 2, new DEROctetString(Pack.intToBigEndian(keySize))));

    try
    {
        kdf.init(new KDFParameters(z, new DERSequence(v).getEncoded(ASN1Encoding.DER)));
    }
    catch (IOException e)
    {
        throw new IllegalArgumentException("unable to initialise kdf: " + e.getMessage());
    }

    return kdf.generateBytes(out, outOff, len);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:22,代码来源:ECDHKEKGenerator.java


示例6: init

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public void init(CipherParameters params)
    throws IllegalArgumentException
{
    if (!(params instanceof KeyParameter))
    {
        throw new IllegalArgumentException("'params' must be an instance of KeyParameter");
    }
    KeyParameter keyParameter = (KeyParameter)params;
    byte[] key = keyParameter.getKey();
    if (key.length != 16)
    {
        throw new IllegalArgumentException("'params' must be a 128-bit key");
    }

    this.k0 = Pack.littleEndianToLong(key, 0);
    this.k1 = Pack.littleEndianToLong(key, 8);

    reset();
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:20,代码来源:SipHash.java


示例7: multiplyH

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public void multiplyH(byte[] x)
    {
//      assert x.Length == 16;

        int[] z = new int[4];
        for (int i = 15; i >= 0; --i)
        {
//            GCMUtil.xor(z, M[i][x[i] & 0xff]);
            int[] m = M[i][x[i] & 0xff];
            z[0] ^= m[0];
            z[1] ^= m[1];
            z[2] ^= m[2];
            z[3] ^= m[3];
        }

        Pack.intToBigEndian(z, x, 0);
    }
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:18,代码来源:Tables64kGCMMultiplier.java


示例8: doFinal

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public int doFinal(
    byte[]  out,
    int     outOff)
{
    finish();

    Pack.longToBigEndian(H1, out, outOff);
    Pack.longToBigEndian(H2, out, outOff + 8);
    Pack.longToBigEndian(H3, out, outOff + 16);
    Pack.longToBigEndian(H4, out, outOff + 24);
    Pack.longToBigEndian(H5, out, outOff + 32);
    Pack.longToBigEndian(H6, out, outOff + 40);

    reset();

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


示例9: SHA256Digest

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public SHA256Digest(byte[] encodedState)
{
    super(encodedState);

    H1 = Pack.bigEndianToInt(encodedState, 16);
    H2 = Pack.bigEndianToInt(encodedState, 20);
    H3 = Pack.bigEndianToInt(encodedState, 24);
    H4 = Pack.bigEndianToInt(encodedState, 28);
    H5 = Pack.bigEndianToInt(encodedState, 32);
    H6 = Pack.bigEndianToInt(encodedState, 36);
    H7 = Pack.bigEndianToInt(encodedState, 40);
    H8 = Pack.bigEndianToInt(encodedState, 44);

    xOff = Pack.bigEndianToInt(encodedState, 48);
    for (int i = 0; i != xOff; i++)
    {
        X[i] = Pack.bigEndianToInt(encodedState, 52 + (i * 4));
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:20,代码来源:SHA256Digest.java


示例10: getEncodedState

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public byte[] getEncodedState()
{
    byte[] state = new byte[52 + xOff * 4];

    super.populateState(state);

    Pack.intToBigEndian(H1, state, 16);
    Pack.intToBigEndian(H2, state, 20);
    Pack.intToBigEndian(H3, state, 24);
    Pack.intToBigEndian(H4, state, 28);
    Pack.intToBigEndian(H5, state, 32);
    Pack.intToBigEndian(H6, state, 36);
    Pack.intToBigEndian(H7, state, 40);
    Pack.intToBigEndian(H8, state, 44);
    Pack.intToBigEndian(xOff, state, 48);

    for (int i = 0; i != xOff; i++)
    {
        Pack.intToBigEndian(X[i], state, 52 + (i * 4));
    }

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


示例11: SHA1Digest

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public SHA1Digest(byte[] encodedState)
{
    super(encodedState);

    H1 = Pack.bigEndianToInt(encodedState, 16);
    H2 = Pack.bigEndianToInt(encodedState, 20);
    H3 = Pack.bigEndianToInt(encodedState, 24);
    H4 = Pack.bigEndianToInt(encodedState, 28);
    H5 = Pack.bigEndianToInt(encodedState, 32);

    xOff = Pack.bigEndianToInt(encodedState, 36);
    for (int i = 0; i != xOff; i++)
    {
        X[i] = Pack.bigEndianToInt(encodedState, 40 + (i * 4));
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:17,代码来源:SHA1Digest.java


示例12: populateState

import org.bouncycastle.util.Pack; //导入依赖的package包/类
protected void populateState(byte[] state)
{
    System.arraycopy(xBuf, 0, state, 0, xBufOff);
    Pack.intToBigEndian(xBufOff, state, 8);
    Pack.longToBigEndian(byteCount1, state, 12);
    Pack.longToBigEndian(byteCount2, state, 20);
    Pack.longToBigEndian(H1, state, 28);
    Pack.longToBigEndian(H2, state, 36);
    Pack.longToBigEndian(H3, state, 44);
    Pack.longToBigEndian(H4, state, 52);
    Pack.longToBigEndian(H5, state, 60);
    Pack.longToBigEndian(H6, state, 68);
    Pack.longToBigEndian(H7, state, 76);
    Pack.longToBigEndian(H8, state, 84);

    Pack.intToBigEndian(wOff, state, 92);
    for (int i = 0; i < wOff; i++)
    {
        Pack.longToBigEndian(W[i], state, 96 + (i * 8));
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:22,代码来源:LongDigest.java


示例13: multiplyH

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public void multiplyH(byte[] x)
    {
//      assert x.Length == 16;

        int[] z = new int[4];
        for (int i = 15; i >= 0; --i)
        {
//            GCMUtil.xor(z, M[i + i][x[i] & 0x0f]);
            int[] m = M[i + i][x[i] & 0x0f];
            z[0] ^= m[0];
            z[1] ^= m[1];
            z[2] ^= m[2];
            z[3] ^= m[3];
//            GCMUtil.xor(z, M[i + i + 1][(x[i] & 0xf0) >>> 4]);
            m = M[i + i + 1][(x[i] & 0xf0) >>> 4];
            z[0] ^= m[0];
            z[1] ^= m[1];
            z[2] ^= m[2];
            z[3] ^= m[3];
        }

        Pack.intToBigEndian(z, x, 0);
    }
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:24,代码来源:Tables8kGCMMultiplier.java


示例14: doFinal

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public int doFinal(
    byte[]  out,
    int     outOff)
{
    finish();

    Pack.longToBigEndian(H1, out, outOff);
    Pack.longToBigEndian(H2, out, outOff + 8);
    Pack.longToBigEndian(H3, out, outOff + 16);
    Pack.longToBigEndian(H4, out, outOff + 24);
    Pack.longToBigEndian(H5, out, outOff + 32);
    Pack.longToBigEndian(H6, out, outOff + 40);
    Pack.longToBigEndian(H7, out, outOff + 48);
    Pack.longToBigEndian(H8, out, outOff + 56);

    reset();

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


示例15: toBigInteger64

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public static BigInteger toBigInteger64(long[] x)
{
    byte[] bs = new byte[16];
    for (int i = 0; i < 2; ++i)
    {
        long x_i = x[i];
        if (x_i != 0L)
        {
            Pack.longToBigEndian(x_i, bs, (1 - i) << 3);
        }
    }
    return new BigInteger(1, bs);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:14,代码来源:Nat128.java


示例16: toBigInteger

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public static BigInteger toBigInteger(int len, int[] x)
{
    byte[] bs = new byte[len << 2];
    for (int i = 0; i < len; ++i)
    {
        int x_i = x[i];
        if (x_i != 0)
        {
            Pack.intToBigEndian(x_i, bs, (len - 1 - i) << 2);
        }
    }
    return new BigInteger(1, bs);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:14,代码来源:Nat.java


示例17: toBigInteger

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public static BigInteger toBigInteger(int[] x)
{
    byte[] bs = new byte[32];
    for (int i = 0; i < 8; ++i)
    {
        int x_i = x[i];
        if (x_i != 0)
        {
            Pack.intToBigEndian(x_i, bs, (7 - i) << 2);
        }
    }
    return new BigInteger(1, bs);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:14,代码来源:Nat256.java


示例18: toBigInteger64

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public static BigInteger toBigInteger64(long[] x)
{
    byte[] bs = new byte[32];
    for (int i = 0; i < 4; ++i)
    {
        long x_i = x[i];
        if (x_i != 0L)
        {
            Pack.longToBigEndian(x_i, bs, (3 - i) << 3);
        }
    }
    return new BigInteger(1, bs);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:14,代码来源:Nat256.java


示例19: toBigInteger64

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public static BigInteger toBigInteger64(long[] x)
{
    byte[] bs = new byte[56];
    for (int i = 0; i < 7; ++i)
    {
        long x_i = x[i];
        if (x_i != 0L)
        {
            Pack.longToBigEndian(x_i, bs, (6 - i) << 3);
        }
    }
    return new BigInteger(1, bs);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:14,代码来源:Nat448.java


示例20: toBigInteger

import org.bouncycastle.util.Pack; //导入依赖的package包/类
public static BigInteger toBigInteger(int[] x)
{
    byte[] bs = new byte[28];
    for (int i = 0; i < 7; ++i)
    {
        int x_i = x[i];
        if (x_i != 0)
        {
            Pack.intToBigEndian(x_i, bs, (6 - i) << 2);
        }
    }
    return new BigInteger(1, bs);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:14,代码来源:Nat224.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MediaQueueItem类代码示例发布时间:2022-05-23
下一篇:
Java ReflectionEquals类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap