fork download
  1. base24 = "BCDFGHJKMPQRTVWXY2346789"
  2.  
  3. # Takes an iterable of the hex from positions 52 to 66 from the registry key:
  4. # HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Registration\{[a-z0-9]+}\DigitalProductID
  5. # Converts the hex into the standard (base 24) representation of the key
  6. def conv_base24(data):
  7. data = [x for x in data[::-1]]
  8. sum = 0
  9. for i in data:
  10. sum = 2**8 * sum + i # Each number is an 8 bit hex value
  11.  
  12. #convert the decimal into base 24.
  13. result = ""
  14. for i in range(25):
  15. if i % 5 == 0 and i != 0:
  16. result = "-" + result
  17. result = str(base24[sum%24]) + result
  18. sum = sum/24
  19. return result
Success #stdin #stdout 0.02s 7088KB
stdin
E9 0C 00 00 00 00 38 3B 2E 9F 64 F1 86 0A 08
stdout
Standard output is empty