1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| from z3 import * arr = [0x4884,0x91C4,0x7D35,0x81FE,0x5DB9,0x817F,0x3B90,0x3597,0x8559,0x6AFF,0x6FDF,0x4815,0x6F31,0x3060,0x512C,0x0B01D,0x8BF3,0x917B,0x65B5,0x99F1,0x44AF,0x5159,0x0ADBA,0x8942,0x9032,0x653E,0x9803,0x4508,0x52E3,0x0AB9F,0x90D0,0x99BF,0x6C91,0x0A1E7,0x46B2,0x5357,0x0B454,0x972A,0x98AC,0x7215,0x9FD1,0x4AAD,0x551A,0x0B5ED,0x95B2,0x0A039,0x7272,0x0A991,0x4CC7,0x0F] a1 = [BitVec('a%d' % i, 8) for i in range(49)] solver = Solver() for i in range(0,49,7): j = 7*int(i/7) solver.add(34 * a1[i+3] + 12 * a1[i+0] + 53 * a1[i+1] + 6 * a1[i+2] + 58 * a1[i+4] + 36 * a1[i+5] + a1[i+6] == arr[j]) solver.add(27 * a1[i+4] + 73 * a1[i+3] + 12 * a1[i+2] + 83 * a1[i+0] + 85 * a1[i+1] + 96 * a1[i+5] + 52 * a1[i+6] == arr[j +1]) solver.add(24 * a1[i+2] + 78 * a1[i+0] + 53 * a1[i+1] + 36 * a1[i+3] + 86 * a1[i+4] + 25 * a1[i+5] + 46 * a1[i+6] == arr[j +2]) solver.add(78 * a1[i+1] + 39 * a1[i+0] + 52 * a1[i+2] + 9 * a1[i+3] + 62 * a1[i+4] + 37 * a1[i+5] + 84 * a1[i+6] == arr[j +3]) solver.add(48 * a1[i+4] + 6 * a1[i+1] + 23 * a1[i+0] + 14 * a1[i+2] + 74 * a1[i+3] + 12 * a1[i+5] + 83 * a1[i+6] == arr[j +4]) solver.add(15 * a1[i+5] + 48 * a1[i+4] + 92 * a1[i+2] + 85 * a1[i+1] + 27 * a1[i+0] + 42 * a1[i+3] + 72 * a1[i+6] == arr[j +5]) solver.add(26 * a1[i+5] + 67 * a1[i+3] + 6 * a1[i+1] + 4 * a1[i+0] + 3 * a1[i+2] + 68 * a1[i+6] == arr[j +6]) if solver.check() != sat: raise RuntimeError() m = solver.model()
flag = '' for i in range(0,49): flag += chr(m[a1[i]].as_long().real) print(flag)
|