本文整理汇总了C++中CryptoPP::VecLoad方法的典型用法代码示例。如果您正苦于以下问题:C++ CryptoPP::VecLoad方法的具体用法?C++ CryptoPP::VecLoad怎么用?C++ CryptoPP::VecLoad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CryptoPP
的用法示例。
在下文中一共展示了CryptoPP::VecLoad方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SPECK64_Dec_Block
void SPECK64_Dec_Block(uint32x4_p &block0, uint32x4_p &block1,
const word32 *subkeys, unsigned int rounds)
{
#if (CRYPTOPP_BIG_ENDIAN)
const uint8x16_p m1 = {7,6,5,4, 15,14,13,12, 23,22,21,20, 31,30,29,28};
const uint8x16_p m2 = {3,2,1,0, 11,10,9,8, 19,18,17,16, 27,26,25,24};
#else
const uint8x16_p m1 = {3,2,1,0, 11,10,9,8, 19,18,17,16, 27,26,25,24};
const uint8x16_p m2 = {7,6,5,4, 15,14,13,12, 23,22,21,20, 31,30,29,28};
#endif
// [A1 A2 A3 A4][B1 B2 B3 B4] ... => [A1 A3 B1 B3][A2 A4 B2 B4] ...
uint32x4_p x1 = VecPermute(block0, block1, m1);
uint32x4_p y1 = VecPermute(block0, block1, m2);
for (int i = static_cast<int>(rounds-1); i >= 0; --i)
{
#if CRYPTOPP_POWER7_AVAILABLE
const uint32x4_p rk = vec_splats(subkeys[i]);
#else
// subkeys has extra elements so memory backs the last subkey
const uint8x16_p m = {0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3};
uint32x4_p rk = VecLoad(subkeys+i);
rk = VecPermute(rk, rk, m);
#endif
y1 = VecXor(y1, x1);
y1 = RotateRight32<3>(y1);
x1 = VecXor(x1, rk);
x1 = VecSub(x1, y1);
x1 = RotateLeft32<8>(x1);
}
#if (CRYPTOPP_BIG_ENDIAN)
const uint8x16_p m3 = {19,18,17,16, 3,2,1,0, 23,22,21,20, 7,6,5,4};
const uint8x16_p m4 = {27,26,25,24, 11,10,9,8, 31,30,29,28, 15,14,13,12};
#else
const uint8x16_p m3 = {3,2,1,0, 19,18,17,16, 7,6,5,4, 23,22,21,20};
const uint8x16_p m4 = {11,10,9,8, 27,26,25,24, 15,14,13,12, 31,30,29,28};
#endif
// [A1 A3 B1 B3][A2 A4 B2 B4] => [A1 A2 A3 A4][B1 B2 B3 B4]
block0 = (uint32x4_p)VecPermute(x1, y1, m3);
block1 = (uint32x4_p)VecPermute(x1, y1, m4);
}