本文整理汇总了Java中org.bouncycastle.util.Pack.intToLittleEndian方法的典型用法代码示例。如果您正苦于以下问题:Java Pack.intToLittleEndian方法的具体用法?Java Pack.intToLittleEndian怎么用?Java Pack.intToLittleEndian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.util.Pack
的用法示例。
在下文中一共展示了Pack.intToLittleEndian方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: packBlock
import org.bouncycastle.util.Pack; //导入方法依赖的package包/类
private void packBlock(byte[] bytes, int off)
{
Pack.intToLittleEndian(this.C0, bytes, off);
Pack.intToLittleEndian(this.C1, bytes, off + 4);
Pack.intToLittleEndian(this.C2, bytes, off + 8);
Pack.intToLittleEndian(this.C3, bytes, off + 12);
}
示例2: MFcrypt
import org.bouncycastle.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);
}
}
示例3: encryptBlock
import org.bouncycastle.util.Pack; //导入方法依赖的package包/类
/**
* Encrypt one block of plaintext.
*
* @param input the array containing the input data.
* @param inOff offset into the in array the data starts at.
* @param output the array the output data will be copied into.
* @param outOff the offset into the out array the output will start at.
*/
protected void encryptBlock(
byte[] input,
int inOff,
byte[] output,
int outOff)
{
X0 = Pack.littleEndianToInt(input, inOff);
X1 = Pack.littleEndianToInt(input, inOff + 4);
X2 = Pack.littleEndianToInt(input, inOff + 8);
X3 = Pack.littleEndianToInt(input, inOff + 12);
sb0(wKey[0] ^ X0, wKey[1] ^ X1, wKey[2] ^ X2, wKey[3] ^ X3); LT();
sb1(wKey[4] ^ X0, wKey[5] ^ X1, wKey[6] ^ X2, wKey[7] ^ X3); LT();
sb2(wKey[8] ^ X0, wKey[9] ^ X1, wKey[10] ^ X2, wKey[11] ^ X3); LT();
sb3(wKey[12] ^ X0, wKey[13] ^ X1, wKey[14] ^ X2, wKey[15] ^ X3); LT();
sb4(wKey[16] ^ X0, wKey[17] ^ X1, wKey[18] ^ X2, wKey[19] ^ X3); LT();
sb5(wKey[20] ^ X0, wKey[21] ^ X1, wKey[22] ^ X2, wKey[23] ^ X3); LT();
sb6(wKey[24] ^ X0, wKey[25] ^ X1, wKey[26] ^ X2, wKey[27] ^ X3); LT();
sb7(wKey[28] ^ X0, wKey[29] ^ X1, wKey[30] ^ X2, wKey[31] ^ X3); LT();
sb0(wKey[32] ^ X0, wKey[33] ^ X1, wKey[34] ^ X2, wKey[35] ^ X3); LT();
sb1(wKey[36] ^ X0, wKey[37] ^ X1, wKey[38] ^ X2, wKey[39] ^ X3); LT();
sb2(wKey[40] ^ X0, wKey[41] ^ X1, wKey[42] ^ X2, wKey[43] ^ X3); LT();
sb3(wKey[44] ^ X0, wKey[45] ^ X1, wKey[46] ^ X2, wKey[47] ^ X3); LT();
sb4(wKey[48] ^ X0, wKey[49] ^ X1, wKey[50] ^ X2, wKey[51] ^ X3); LT();
sb5(wKey[52] ^ X0, wKey[53] ^ X1, wKey[54] ^ X2, wKey[55] ^ X3); LT();
sb6(wKey[56] ^ X0, wKey[57] ^ X1, wKey[58] ^ X2, wKey[59] ^ X3); LT();
sb7(wKey[60] ^ X0, wKey[61] ^ X1, wKey[62] ^ X2, wKey[63] ^ X3); LT();
sb0(wKey[64] ^ X0, wKey[65] ^ X1, wKey[66] ^ X2, wKey[67] ^ X3); LT();
sb1(wKey[68] ^ X0, wKey[69] ^ X1, wKey[70] ^ X2, wKey[71] ^ X3); LT();
sb2(wKey[72] ^ X0, wKey[73] ^ X1, wKey[74] ^ X2, wKey[75] ^ X3); LT();
sb3(wKey[76] ^ X0, wKey[77] ^ X1, wKey[78] ^ X2, wKey[79] ^ X3); LT();
sb4(wKey[80] ^ X0, wKey[81] ^ X1, wKey[82] ^ X2, wKey[83] ^ X3); LT();
sb5(wKey[84] ^ X0, wKey[85] ^ X1, wKey[86] ^ X2, wKey[87] ^ X3); LT();
sb6(wKey[88] ^ X0, wKey[89] ^ X1, wKey[90] ^ X2, wKey[91] ^ X3); LT();
sb7(wKey[92] ^ X0, wKey[93] ^ X1, wKey[94] ^ X2, wKey[95] ^ X3); LT();
sb0(wKey[96] ^ X0, wKey[97] ^ X1, wKey[98] ^ X2, wKey[99] ^ X3); LT();
sb1(wKey[100] ^ X0, wKey[101] ^ X1, wKey[102] ^ X2, wKey[103] ^ X3); LT();
sb2(wKey[104] ^ X0, wKey[105] ^ X1, wKey[106] ^ X2, wKey[107] ^ X3); LT();
sb3(wKey[108] ^ X0, wKey[109] ^ X1, wKey[110] ^ X2, wKey[111] ^ X3); LT();
sb4(wKey[112] ^ X0, wKey[113] ^ X1, wKey[114] ^ X2, wKey[115] ^ X3); LT();
sb5(wKey[116] ^ X0, wKey[117] ^ X1, wKey[118] ^ X2, wKey[119] ^ X3); LT();
sb6(wKey[120] ^ X0, wKey[121] ^ X1, wKey[122] ^ X2, wKey[123] ^ X3); LT();
sb7(wKey[124] ^ X0, wKey[125] ^ X1, wKey[126] ^ X2, wKey[127] ^ X3);
Pack.intToLittleEndian(wKey[128] ^ X0, output, outOff);
Pack.intToLittleEndian(wKey[129] ^ X1, output, outOff + 4);
Pack.intToLittleEndian(wKey[130] ^ X2, output, outOff + 8);
Pack.intToLittleEndian(wKey[131] ^ X3, output, outOff + 12);
}
示例4: generateKeyStream
import org.bouncycastle.util.Pack; //导入方法依赖的package包/类
protected void generateKeyStream(byte[] output)
{
salsaCore(rounds, engineState, x);
Pack.intToLittleEndian(x, output, 0);
}
示例5: generateKeyStream
import org.bouncycastle.util.Pack; //导入方法依赖的package包/类
protected void generateKeyStream(byte[] output)
{
chachaCore(rounds, engineState, x);
Pack.intToLittleEndian(x, output, 0);
}
示例6: doFinal
import org.bouncycastle.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;
}