mcfx's blog - 2020年5月 /2020/05/ 个人博客,(曾经)基本只放题解,现在随便写点啥了吧( De1CTF 2020 Writeup /archives/284/ 2020-05-06T08:26:00+08:00 # Crypto ## NLFSR 可以发现输出是1时,ao是1的概率有75%。可以枚举前19个ao,解方程得到a的初始值,再枚举c和d的初始值,可以得到b的若干状态,最后解方程得到b,再检验。 ```cpp #include typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; typedef double lf; typedef long double llf; typedef std::pair pii; #define xx first #define yy second template inline T max(T a,T b){return a>b?a:b;} template inline T min(T a,T b){return a0?a:-a;} template inline bool repr(T &a,T b){return ab?a=b,1:0;} template inline T gcd(T a,T b){T t;if(a>j&1) { f[i]^=f[j]; v[i]^=v[j]; } uint r=0; fo0(i,19)r+=v[i]