Skip to content

Instantly share code, notes, and snippets.

@feisuzhu
Created May 24, 2012 13:23
Show Gist options
  • Save feisuzhu/2781527 to your computer and use it in GitHub Desktop.
Save feisuzhu/2781527 to your computer and use it in GitHub Desktop.
Reversed an encrypt algorithm of a VB app
tbl1 = 'dBtEGkliy0aLvj61Ph2TIzQSfnY9ArmUFK4Rgs8uWxM7ObwoN3JcCq5VHDeXZp'
tbl2 = 'N04A83D7qTIoBMsyQdVLHPGWwiv59YhFX61RbCxftcmSkJlaEeuOg2pZUKzrnj'
def decode(s):
s = ''.join([tbl2[tbl1.index(i)] for i in s])
s1 = s[0::2]
s2 = s[1::2]
ss1 = [s1[i:i+2] for i in range(0, len(s1), 2)]
ss2 = [s2[i:i+2] for i in range(0, len(s2), 2)]
rst = ''
for c1, c2 in zip(ss1, ss2):
rst += chr(int(c1, 16))
rst += chr(int(c2, 16))
return rst
def dekey(s):
s = decode(s)
l = [s[i:i+4] for i in range(0, len(s), 4)]
return u''.join(unichr(int(i, 16)) for i in l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment