Skip to content

Instantly share code, notes, and snippets.

@SciresM
Created February 10, 2017 06:18
Show Gist options
  • Save SciresM/f22ce61eacc6c030cc19cd824b48c6ef to your computer and use it in GitHub Desktop.
Save SciresM/f22ce61eacc6c030cc19cd824b48c6ef to your computer and use it in GitHub Desktop.
def fe_xor(string, key):
'''Decrypts a Fire Emblem Heroes string using a specified key.'''
if type(key) == str:
key = map(ord, key)
cur_k = (key[0] + key[1]) & 0xFF
crypt = ''
for i in range(len(string)):
cur_k ^= key[i % len(key)]
crypt += chr((cur_k ^ ord(string[i])) or ord(string[i]))
return crypt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment