import random
def decode(z):
x = 0
for i in range(8):
for j in range(8):
ri = random.randint(0, 1)
if ri == 0:
z = z<<1
x = (x<<1)+0
else:
z = (z^0x8408)<<1
x = (x<<1)+1
#x = x + (1<<j)
print(hex(z&0xffff))
print("---: "+hex(x&0xff))
#decode(0x2087)
后面发现不行, 还需要最后计算完时 z为0
最后还是c++暴力搜索
for (u64 s = 0xffffff7f00000000; s < 0xffffff8000000000; s++) {
//s = 0xffffff7f07546359;
u64 z = 0;
for (int i = 0; i < 64; i++) {
if (((s >> i) & 1) != (z & 1)) {
z = (z >> 1) ^ 0x8408;
} else {
z = (z >> 1);
}
}
if (z == 0x2087) {
printf("%llx\n", s);
}
}
#include<stdio.h>
#include<stdint.h>
int main()
{
for (uint64_t s = 0xffffff7f00000000; s < 0xffffff8000000000; s++) {
//s = 0xffffff7f07546359;
uint64_t z = 0;
for (int i = 0; i < 32; i++) {
if (((s >> i) & 1) != (z & 1)) {
z = (z >> 1) ^ 0x8408;
} else {
z = (z >> 1);
}
}
if (z == 0x674) {
printf("%llx\n", s);
if(s == 0xffffff7f07546359){
printf("find the seed: %llx\n", s);
break;
}
}
}
return 0;
}