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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| from z3 import * key=[0x00000017, 0x0000000D, 0x00000004, 0x00000030, 0x00000029, 0x00000029, 0x0000002A, 0x00000021, 0x0000001E, 0x00000003, 0x00000045, 0x00000001, 0x0000000D, 0x0000002D, 0x00000029, 0x00000040, 0x00000008, 0x00000050, 0x0000000F, 0x0000002A, 0x00000038, 0x00000013, 0x0000003E, 0x00000046, 0x00000017, 0x0000003F, 0x0000001E, 0x00000044, 0x00000011, 0x00000038, 0x0000005C, 0x0000000C, 0x00000010, 0x00000040, 0x0000001F, 0x00000003, 0x00000011, 0x00000047, 0x0000003A, 0x00000009, 0x00000040, 0x00000053, 0x00000047, 0x00000034, 0x00000063, 0x00000059, 0x0000004C, 0x00000044, 0x00000001, 0x00000063, 0x00000010, 0x00000010, 0x00000034, 0x0000002B, 0x00000000, 0x0000002C, 0x00000032, 0x00000020, 0x00000032, 0x0000001F, 0x00000014, 0x0000003F, 0x00000002, 0x00000063, 0x00000000, 0x00000039, 0x0000004F, 0x0000002B, 0x00000047, 0x00000013, 0x00000050, 0x0000005C, 0x0000005D, 0x0000003A, 0x00000054, 0x0000004A, 0x00000051, 0x0000002D, 0x00000037, 0x00000015, 0x00000001, 0x00000063, 0x0000001E, 0x0000001C, 0x00000038, 0x00000001, 0x0000000C, 0x0000004D, 0x0000005C, 0x00000004, 0x00000025, 0x00000043, 0x0000003C, 0x00000036, 0x00000033, 0x0000004F, 0x00000026, 0x00000057, 0x00000030, 0x00000010] enc=[0]*40 enc[0] = 33211 enc[1] = 36113 enc[2] = 28786 enc[3] = 44634 enc[4] = 30174 enc[5] = 39163 enc[6] = 34923 enc[7] = 44333 enc[8] = 33574 enc[9] = 23555 enc[10] = 35015 enc[11] = 42724 enc[12] = 34160 enc[13] = 49166 enc[14] = 35770 enc[15] = 45984 enc[16] = 39754 enc[17] = 51672 enc[18] = 38323 enc[19] = 27511 enc[20] = 31334 enc[21] = 34214 enc[22] = 28014 enc[23] = 41090 enc[24] = 29258 enc[25] = 37905 enc[26] = 33777 enc[27] = 39812 enc[28] = 29442 enc[29] = 22225 enc[30] = 30853 enc[31] = 35330 enc[32] = 30393 enc[33] = 41247 enc[34] = 30439 enc[35] = 39434 enc[36] = 31587 enc[37] = 46815 enc[38] = 35205 enc[39] = 20689 inp = [Int('inp%d' % i) for i in range(len(enc))]
s=Solver() flag=''
for k in range(4): for m in range(10): for n in range(10): enc[10 * k + m] -=inp[10 * k + n] * key[10 * n + m]
for i in range(len(enc)): s.add(enc[i]==0)
if s.check()==sat: m=s.model() for i in range(40): flag+=chr(m[inp[i]].as_long()) print(flag)
|