#!/usr/bin/env python3 defencrypt(flag,i): out = 0 and_ch = i & flag #print("i:",hex(i),"ch:",hex(input[i])) src_ch = flag index = i while (1): tmp_ch = 2 * (index & src_ch) src_ch = src_ch^index #print("src_ch:",hex(src_ch)) index = tmp_ch if tmp_ch == 0: break out = src_ch #print (''.join(out)) return out
# def decrypt(ch,i): # out = 0 # tmp_ch = 2 * (i & ch) # src_ch = ch # index = i # while(1): # pass
flag = '' index = 0 while(index < len(encrp)): for i inrange(0,0xFF): encrypted = encrypt(i,index) #print("ecrypt():",i,index) if encrypted == encrp[index]: flag += chr(i) print(flag) index += 1 if index == 32: break