本文整理汇总了Java中org.bouncycastle.crypto.util.Pack.longToLittleEndian方法的典型用法代码示例。如果您正苦于以下问题:Java Pack.longToLittleEndian方法的具体用法?Java Pack.longToLittleEndian怎么用?Java Pack.longToLittleEndian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.crypto.util.Pack
的用法示例。
在下文中一共展示了Pack.longToLittleEndian方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFinal
import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
public int doFinal(byte[] out, int outOff)
throws DataLengthException, IllegalStateException
{
long result = doFinal();
Pack.longToLittleEndian(result, out, outOff);
return 8;
}
示例2: finish
import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
private void finish()
{
Pack.longToLittleEndian(byteCount * 8, L, 0); // get length into L (byteCount * 8 = bitCount)
while (xBufOff != 0)
{
update((byte)0);
}
processBlock(L, 0);
processBlock(Sum, 0);
}
示例3: performTest
import org.bouncycastle.crypto.util.Pack; //导入方法依赖的package包/类
public void performTest()
throws Exception
{
byte[] key = Hex.decode("000102030405060708090a0b0c0d0e0f");
byte[] input = Hex.decode("000102030405060708090a0b0c0d0e");
long expected = 0xa129ca6149be45e5L;
SipHash mac = new SipHash();
mac.init(new KeyParameter(key));
mac.update(input, 0, input.length);
long result = mac.doFinal();
if (expected != result)
{
fail("Result does not match expected value for doFinal()");
}
byte[] expectedBytes = new byte[8];
Pack.longToLittleEndian(expected, expectedBytes, 0);
mac.update(input, 0, input.length);
byte[] output = new byte[mac.getMacSize()];
int len = mac.doFinal(output, 0);
if (len != output.length)
{
fail("Result length does not equal getMacSize() for doFinal(byte[],int)");
}
if (!areEqual(expectedBytes, output))
{
fail("Result does not match expected value for doFinal(byte[],int)");
}
}