Created
January 19, 2019 02:17
-
-
Save jowens/0a2f4dbc7876d18fbcd385d2f6b67ce8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
codes = ['YAOONGPE', 'TEUZZYAE', 'TENNIPAE', 'LAXAALAA', 'YAEKPLAE', 'IEXGVYZA', 'YEXIKOYA', 'IPUGAGZP', 'GPKUAEZA', | |
'LOEKSAPA', 'ZPSLPXZA', 'PEEVAZTA', 'IAXVYEYE', 'ZAOKPZLE', 'GEOGNTAA', 'PEEKYPLA', 'GPEGKILA', 'PEKSVGLA'] | |
test_code = 'ZEXPYGLA' | |
hex_map = dict() | |
hex_map['A'] = 0x0 | |
hex_map['P'] = 0x1 | |
hex_map['Z'] = 0x2 | |
hex_map['L'] = 0x3 | |
hex_map['G'] = 0x4 | |
hex_map['I'] = 0x5 | |
hex_map['T'] = 0x6 | |
hex_map['Y'] = 0x7 | |
hex_map['E'] = 0x8 | |
hex_map['O'] = 0x9 | |
hex_map['X'] = 0xA | |
hex_map['U'] = 0xB | |
hex_map['K'] = 0xC | |
hex_map['S'] = 0xD | |
hex_map['V'] = 0xE | |
hex_map['N'] = 0xF | |
code = test_code | |
print(hex(0x8000 + ((hex_map[code[3]] & 7) << 12) | ((hex_map[code[5]] & 7) << 8) | ((hex_map[code[4]] & 8) << 8) | ( | |
(hex_map[code[2]] & 7) << 4) | ((hex_map[code[1]] & 8) << 4) | (hex_map[code[4]] & 7) | (hex_map[code[3]] & 8))) | |
print(((hex_map[code[1]] & 7) << 4) | ((hex_map[code[0]] & 8) << 4) | ( | |
hex_map[code[0]] & 7) | (hex_map[code[5]] & 8)) | |
print() | |
for code in codes: | |
compare = ((hex_map[code[7]] & 7) << 4) | ((hex_map[code[6]] & 8) << 4) | ( | |
hex_map[code[6]] & 7) | (hex_map[code[5]] & 8) | |
address = 0x8000 + ((hex_map[code[3]] & 7) << 12) | ((hex_map[code[5]] & 7) << 8) | ((hex_map[code[4]] & 8) << 8) | ( | |
(hex_map[code[2]] & 7) << 4) | ((hex_map[code[1]] & 8) << 4) | (hex_map[code[4]] & 7) | (hex_map[code[3]] & 8) | |
data = ((hex_map[code[1]] & 7) << 4) | ((hex_map[code[0]] & 8) << 4) | ( | |
hex_map[code[0]] & 7) | (hex_map[code[5]] & 8) | |
print(hex(address), hex(data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment