# Chain Here we have a function which does some comparisions on the input string passed to it, in each comparsion it xors three characters in the string passed to the function and compares it to a value in memory Getting those values in the memory and using Z3 to find the input we get the flag ```py from z3 import * a=[0x67,0x65,0x22,0x32,0x39,0x39,0x2,0x4,0x44,0x44,0x1c,0xa,0x32,0x76] f = [ BitVec('a%s' % i, 8) for i in range(len(a)) ] s = Solver() s.add(a[0]==f[0]^f[2]^f[4]) s.add(a[1]==f[2]^f[4]^f[6]) s.add(a[2]==f[4]^f[6]^f[8]) s.add(a[3]==f[6]^f[8]^f[10]) s.add(a[4]==f[8]^f[10]^f[12]) s.add(a[5]==f[10]^f[12]^f[1]) s.add(a[6]==f[12]^f[1]^f[3]) s.add(a[7]==f[1]^f[3]^f[5]) s.add(a[8]==f[3]^f[5]^f[7]) s.add(a[9]==f[5]^f[7]^f[9]) s.add(a[10]==f[7]^f[9]^f[11]) s.add(a[11]==f[9]^f[11]^f[13]) s.add(a[12]==f[11]^f[13]^f[0]) s.add(a[13]==f[13]^f[0]^f[2]) s.check() print("flag{",end='') if (s.check()): g = s.model() for i in f: print(chr(int(str((g[i])))),end="") print("}") ``` ##### Flag: `flag{g3t_thes3_d0ne}` ###### tags: `Z3`