算法逻辑
int main() {uint64_t data = { 0x2882d802120e,0x28529a05954,0x486088c03,0xc0fb3b55754,0xc2b9b7f8651,0xae83fb054c,0x29abf6ddcb15,0x10e261fc807,0x2a82fe86d707,0xe0cb79a5706,0x330560890d06 };
uint32_t flag = { 0 };
for (int i = 0; i < 11; ++i) {
flag = (((data ^ (data >> 15)) >> 15) & 0xfffffffc) | (data & 0x3);
}
求大佬教教这个算法的逻辑,我认为这是减少字节,并且换了顺序,但就是弄不明白 本帖最后由 yes2 于 2023-12-6 22:01 编辑
uint64_t data = { 0x2882d802120e, 0x28529a05954, 0x486088c03, 0xc0fb3b55754, 0xc2b9b7f8651, 0xae83fb054c, 0x29abf6ddcb15, 0x10e261fc807, 0x2a82fe86d707, 0xe0cb79a5706, 0x330560890d06 };
uint32_t flag = { 0 };
for (int i = 0; i < 11; ++i) {
uint64_t a = data >> 15;// 低15位不参与异或,先丢弃;最高2位应该也没有用到
uint64_t b = a >> 15; // 再次右移15位作为异或子
uint64_t c = b ^ a; // 异或 ^
uint64_t d = c & 0xfffffffc; // 保留
flag = d | (data & 0x3);// 合并
}
所以应该是64位数值按位来,取位 ^ 的结果作为flag的位,照抄
页:
[1]