1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <memory.h> #include <string.h> #include <math.h>
void printArray(char *name,uint8_t *data,size_t len){ printf("==============%s========\n",name); for(size_t i=0;i<len;i++){ printf("0x%02x,",data[i]); } printf("\n================================\n"); } uint32_t calc(uint32_t d1,uint32_t d2,uint32_t d3,uint32_t d4){ return d1*d1*d2+d1*d3+d4; } int main(){ uint32_t addDat[] = {0xb2b0,0x6e72,0x6061,0x565d,0x942d,0xac79,0x391c,0x643d,0xec3f,0xbd10,0xc43e,0x7a65,0x184b,0xef5b,0x5a06,0xa8c0,0xf64b,0xc774,0x02ff,0x8e57,0xaed9,0xd8a9,0x230c,0x74e8,0xc2a6,0x88b3,0xaf2a,0x9ea7,0xce8a,0x5924,0xd276,0x56d4,0x77d7,0x990e,0xb585,0x4bcd,0x5277,0x1afc,0x8c8a,0xcdb5,0x6e26,0x4c22,0x673f,0xdaff,0x0fac,0x86c7,0xe048,0xc483,0x85d3,0x2204,0xc2ee,0xe07f,0x0caf,0xbf76,0x63fe,0xbffb,0x4b09,0xe5b3,0x8bda,0x96df,0x866d,0x1719,0x6bcf,0xadcc,0x0f2b,0x51ce,0x1549,0x20c1,0x3a8d,0x05f5,0x5403,0x1125,0x9161,0xe2a5,0x5196,0xd8d2,0xd644,0xee86,0x3896,0x2e71,0xa6f1,0xdfcf,0x3ece,0x7d49,0xc24d,0x237e,0x9352,0x7a97,0x7bfa,0xcbaa,0x10dc,0x3bd9,0x7d7b,0x3b88,0xb0d0,0xe8bc}; uint32_t cmpDat[] = {0x08a73233,0x116db0f6,0x0e654937,0x03c374a7,0x16bc8ed9,0x0846b755,0x08949f47,0x04a13c27,0x0976cf0a,0x07461189,0x1e1a5c12,0x11e64d96,0x03cf09b3,0x093cb610,0x0d41ea64,0x07648050,0x092039bf,0x08e7f1f7,0x004d871f,0x1680f823,0x06f3c3eb,0x2205134d,0x015c6a7c,0x11c67ed0,0x0817b32e,0x06bd9b92,0x08806b0c,0x06aaa515,0x205b9f76,0x0de963e9,0x2194e8e2,0x047593bc}; printf("%d\n",sizeof(addDat)/4); printf("%d\n",sizeof(cmpDat)/4); printf("0x%08x 0x%08x 0x%08x\n",addDat[0],addDat[1],cmpDat[0]); uint8_t flag[33]={0}; uint32_t addT; char dic[] = "0123456789abcdef";
for(size_t i=0;i<32;i++){
for(size_t j=0;j<16;j++){ if(calc(dic[j],addDat[i],addDat[i+32],addDat[i+64])==cmpDat[i]){ flag[i]=dic[j]; break; } } } printArray("flag",flag,32); printf("%s\n",flag); printf("%d\n",strlen(flag)); return 0; }
|