本文整理汇总了C++中Trail::save方法的典型用法代码示例。如果您正苦于以下问题:C++ Trail::save方法的具体用法?C++ Trail::save怎么用?C++ Trail::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trail
的用法示例。
在下文中一共展示了Trail::save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateTrailFromDinurDunkelmanShamirCollision
/** Example function that generates a trail from a pair of inputs.
* In this example, we use the messages found by I. Dinur, O. Dunkelman
* and A. Shamir to produce a collision on Keccak[r=1088, c=512] reduced
* to 4 rounds.
*/
void generateTrailFromDinurDunkelmanShamirCollision()
{
const UINT8 M1[] =
"\x32\x1c\xf3\xc4\x6d\xae\x59\x4c\xf4\xf0\x19\x5d\x4b\xe4\xc4\x25"
"\x32\x30\x85\xd8\xf2\x12\x5e\x8d\xe2\x6e\x6e\xbb\x1e\x3b\xc3\x27"
"\x58\x10\x09\x6c\xd5\x02\x90\xeb\x6f\xa0\xa4\x3b\xf1\xc7\x0c\x4a"
"\x51\x5e\xb5\xcc\x83\xd9\x0d\x8d\x43\x08\x0a\x2b\xb0\xd3\x21\x9b"
"\x75\x90\x67\x53\xd2\xde\x6d\x52\x44\x48\x29\x48\x2c\xed\xf4\x6f"
"\x15\x2c\xce\x1a\xc7\x1d\x1c\x47\x68\x85\x09\xd4\x39\xf6\xeb\xf1"
"\x57\xb2\xf7\xea\x87\xae\xfd\x09\xe6\x78\x88\x68\x30\xeb\x75\x48"
"\x80\x2d\xc3\xc9\xcb\x6f\x9e\x3c\xfa\xbc\x2a\x3c\x7b\x80\xa4\xe6"
"\xb8\x81\xb2\x2a\xb3\x32\x23";
const unsigned int M1len = 135;
UINT8 M2[] =
"\xf7\x0e\xd3\xa4\x69\x8f\xbb\x80\xdf\x48\xc0\x90\xb9\x13\x72\xeb"
"\x24\x04\x65\xa6\x3e\xf6\x65\x3a\x81\x88\x26\x8c\x1f\xb8\x51\xb6"
"\x3c\xfa\xda\xaa\xc3\xa5\x2c\xee\xc2\xea\x78\xdb\x79\xe7\xea\xc8"
"\x35\x9c\x2f\x44\x87\xe2\x21\x32\x5a\x7a\x01\xb3\x12\x07\x79\x90"
"\xdc\x8b\x1c\x1b\xa8\x10\x8b\xe0\xca\x25\x9d\x9a\xac\xaa\xe7\x1b"
"\x9c\x3e\x2f\x4e\xad\x7d\x71\x73\x5a\x01\x66\x55\xb9\xcf\x98\xa1"
"\xc2\xa8\x1c\x5a\x8a\x34\xe3\xa0\xb1\x0b\x6c\xae\xe4\xf9\x80\x39"
"\x91\x8b\xfa\xa4\x89\xa9\x81\x6e\xaa\xbc\xa9\x89\xf1\xf1\x2b\xe1"
"\x95\x95\xef\x30\x45\x8b\x2e";
const unsigned int M2len = 135;
{
UINT8 output[32];
ReducedRoundKeccak keccak(1088, 512, 4);
keccak.absorb(M1, M1len*8);
keccak.squeeze(output, 256);
for(unsigned int i=0; i<32; i++)
cout << hex << (int)output[i] << " ";
cout << endl;
}
{
UINT8 output[32];
ReducedRoundKeccak keccak(1088, 512, 4);
keccak.absorb(M2, M2len*8);
keccak.squeeze(output, 256);
for(unsigned int i=0; i<32; i++)
cout << hex << (int)output[i] << " ";
cout << endl;
}
{
KeccakFDCEquations keccakF(1600, 4);
KeccakFPropagation DC(keccakF, KeccakFPropagation::DC);
vector<LaneValue> m1lanes, m2lanes;
{
UINT8 temp[200];
memset(temp, 0, 200);
memcpy(temp, M1, M1len);
temp[M1len] = 0x81;
keccakF.fromBytesToLanes(temp, m1lanes);
}
{
UINT8 temp[200];
memset(temp, 0, 200);
memcpy(temp, M2, M2len);
temp[M2len] = 0x81;
keccakF.fromBytesToLanes(temp, m2lanes);
}
vector<SliceValue> m1slices, m2slices;
fromLanesToSlices(m1lanes, m1slices, 64);
fromLanesToSlices(m2lanes, m2slices, 64);
Trail trail;
keccakF.buildDCTrailFromPair(m1slices, m2slices, trail);
{
ofstream fout("DinurEtAl.trail");
trail.save(fout);
}
Trail::produceHumanReadableFile(DC, "DinurEtAl.trail");
}
}