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


Java Pack.intToLittleEndian方法代码示例

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


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

示例1: MFcrypt

import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
private static byte[] MFcrypt(byte[] P, byte[] S, int N, int r, int p, int dkLen)
{
    int MFLenBytes = r * 128;
    byte[] bytes = SingleIterationPBKDF2(P, S, p * MFLenBytes);

    int[] B = null;

    try
    {
        int BLen = bytes.length >>> 2;
        B = new int[BLen];

        Pack.littleEndianToInt(bytes, 0, B);

        int MFLenWords = MFLenBytes >>> 2;
        for (int BOff = 0; BOff < BLen; BOff += MFLenWords)
        {
            // TODO These can be done in parallel threads
            SMix(B, BOff, N, r);
        }

        Pack.intToLittleEndian(B, bytes, 0);

        return SingleIterationPBKDF2(P, bytes, dkLen);
    }
    finally
    {
        Clear(bytes);
        Clear(B);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:32,代码来源:SCrypt.java

示例2: generateKeyStream

import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
private void generateKeyStream(byte[] output)
{
    salsaCore(20, engineState, x);
    Pack.intToLittleEndian(x, output, 0);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:6,代码来源:Salsa20Engine.java

示例3: generateKeyStream

import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
protected void generateKeyStream(byte[] output)
{
    salsaCore(rounds, engineState, x);
    Pack.intToLittleEndian(x, output, 0);
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:6,代码来源:Salsa20Engine.java

示例4: generateKeyStream

import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
protected void generateKeyStream(byte[] output)
{
    chachaCore(rounds, engineState, x);
    Pack.intToLittleEndian(x, output, 0);
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:6,代码来源:ChaChaEngine.java

示例5: doFinal

import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
public int doFinal(final byte[] out, final int outOff)
    throws DataLengthException,
    IllegalStateException
{
    if (outOff + BLOCK_SIZE > out.length)
    {
        throw new DataLengthException("Output buffer is too short.");
    }

    if (currentBlockOffset > 0)
    {
        // Process padded final block
        processBlock();
    }

    long f0, f1, f2, f3;

    int b = h0 >>> 26;
    h0 = h0 & 0x3ffffff;
    h1 += b; b = h1 >>> 26; h1 = h1 & 0x3ffffff;
    h2 += b; b = h2 >>> 26; h2 = h2 & 0x3ffffff;
    h3 += b; b = h3 >>> 26; h3 = h3 & 0x3ffffff;
    h4 += b; b = h4 >>> 26; h4 = h4 & 0x3ffffff;
    h0 += b * 5;

    int g0, g1, g2, g3, g4;
    g0 = h0 + 5; b = g0 >>> 26; g0 &= 0x3ffffff;
    g1 = h1 + b; b = g1 >>> 26; g1 &= 0x3ffffff;
    g2 = h2 + b; b = g2 >>> 26; g2 &= 0x3ffffff;
    g3 = h3 + b; b = g3 >>> 26; g3 &= 0x3ffffff;
    g4 = h4 + b - (1 << 26);

    b = (g4 >>> 31) - 1;
    int nb = ~b;
    h0 = (h0 & nb) | (g0 & b);
    h1 = (h1 & nb) | (g1 & b);
    h2 = (h2 & nb) | (g2 & b);
    h3 = (h3 & nb) | (g3 & b);
    h4 = (h4 & nb) | (g4 & b);

    f0 = (((h0       ) | (h1 << 26)) & 0xffffffffl) + (0xffffffffL & k0);
    f1 = (((h1 >>> 6 ) | (h2 << 20)) & 0xffffffffl) + (0xffffffffL & k1);
    f2 = (((h2 >>> 12) | (h3 << 14)) & 0xffffffffl) + (0xffffffffL & k2);
    f3 = (((h3 >>> 18) | (h4 << 8 )) & 0xffffffffl) + (0xffffffffL & k3);

    Pack.intToLittleEndian((int)f0, out, outOff);
    f1 += (f0 >>> 32);
    Pack.intToLittleEndian((int)f1, out, outOff + 4);
    f2 += (f1 >>> 32);
    Pack.intToLittleEndian((int)f2, out, outOff + 8);
    f3 += (f2 >>> 32);
    Pack.intToLittleEndian((int)f3, out, outOff + 12);

    reset();
    return BLOCK_SIZE;
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:57,代码来源:Poly1305.java


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