本文整理汇总了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);
}
}
示例2: generateKeyStream
import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
private void generateKeyStream(byte[] output)
{
salsaCore(20, engineState, x);
Pack.intToLittleEndian(x, output, 0);
}
示例3: generateKeyStream
import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
protected void generateKeyStream(byte[] output)
{
salsaCore(rounds, engineState, x);
Pack.intToLittleEndian(x, output, 0);
}
示例4: generateKeyStream
import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
protected void generateKeyStream(byte[] output)
{
chachaCore(rounds, engineState, x);
Pack.intToLittleEndian(x, output, 0);
}
示例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;
}