Why this function:
uint64_t rot_xor(uint64_t a1, uint64_t a2) {
int size = sizeof(a1)*4;
cout<<" "<<"size:"<<bitset<8>(size).to_string()<<" "<<size;
int shift;
uint64_t output = 0;
cout<<endl;
for (shift = 0; shift < size; shift++)
if(a1&(1<<shift)) {
output ^= (a2 << shift) | (a2 >> (size - shift));
cout << bitset<64>(output).to_string()<<endl;
}
return output;
}
Print output:
point 1
If the question is why your program prints 20 as a result of what seems to be sizeof(uint64_t) * 4
instead of 32, well it's because a few lines before calling rot_xor
there is a:
cout << hex
In fact, the exact output as can be seen in the link you posted is
size:00100000 20
or 32 in binary and hexadecimal representation.
point 2
I have no idea what your expected ouput should be like.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.