Guest User

Untitled

a guest
Jan 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. codes = ['YAOONGPE', 'TEUZZYAE', 'TENNIPAE', 'LAXAALAA', 'YAEKPLAE', 'IEXGVYZA', 'YEXIKOYA', 'IPUGAGZP', 'GPKUAEZA',
  2. 'LOEKSAPA', 'ZPSLPXZA', 'PEEVAZTA', 'IAXVYEYE', 'ZAOKPZLE', 'GEOGNTAA', 'PEEKYPLA', 'GPEGKILA', 'PEKSVGLA']
  3. test_code = 'ZEXPYGLA'
  4.  
  5. hex_map = dict()
  6.  
  7. hex_map['A'] = 0x0
  8. hex_map['P'] = 0x1
  9. hex_map['Z'] = 0x2
  10. hex_map['L'] = 0x3
  11. hex_map['G'] = 0x4
  12. hex_map['I'] = 0x5
  13. hex_map['T'] = 0x6
  14. hex_map['Y'] = 0x7
  15. hex_map['E'] = 0x8
  16. hex_map['O'] = 0x9
  17. hex_map['X'] = 0xA
  18. hex_map['U'] = 0xB
  19. hex_map['K'] = 0xC
  20. hex_map['S'] = 0xD
  21. hex_map['V'] = 0xE
  22. hex_map['N'] = 0xF
  23.  
  24. code = test_code
  25. print(hex(0x8000 + ((hex_map[code[3]] & 7) << 12) | ((hex_map[code[5]] & 7) << 8) | ((hex_map[code[4]] & 8) << 8) | (
  26. (hex_map[code[2]] & 7) << 4) | ((hex_map[code[1]] & 8) << 4) | (hex_map[code[4]] & 7) | (hex_map[code[3]] & 8)))
  27. print(((hex_map[code[1]] & 7) << 4) | ((hex_map[code[0]] & 8) << 4) | (
  28. hex_map[code[0]] & 7) | (hex_map[code[5]] & 8))
  29. print()
  30.  
  31. for code in codes:
  32. compare = ((hex_map[code[7]] & 7) << 4) | ((hex_map[code[6]] & 8) << 4) | (
  33. hex_map[code[6]] & 7) | (hex_map[code[5]] & 8)
  34. address = 0x8000 + ((hex_map[code[3]] & 7) << 12) | ((hex_map[code[5]] & 7) << 8) | ((hex_map[code[4]] & 8) << 8) | (
  35. (hex_map[code[2]] & 7) << 4) | ((hex_map[code[1]] & 8) << 4) | (hex_map[code[4]] & 7) | (hex_map[code[3]] & 8)
  36. data = ((hex_map[code[1]] & 7) << 4) | ((hex_map[code[0]] & 8) << 4) | (
  37. hex_map[code[0]] & 7) | (hex_map[code[5]] & 8)
  38. print(hex(address), hex(data))
Add Comment
Please, Sign In to add comment