Skip to content

Instantly share code, notes, and snippets.

@fritz0705
Created June 8, 2017 19:55
Show Gist options
  • Save fritz0705/0deaeb990d40deed8db26ab1d6ff12da to your computer and use it in GitHub Desktop.
Save fritz0705/0deaeb990d40deed8db26ab1d6ff12da to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import sys
zk_code = sys.argv[-1].rjust(20, "0")
print("ZK Code: {}".format(zk_code))
result = ""
# Iterate though bytes
for i in range(0, 20, 4):
nibble1 = bin(int(zk_code[i:i+2]))[2:].rjust(4, "0")
nibble2 = bin(int(zk_code[i+2:i+4]))[2:].rjust(4, "0")
result += hex(int((nibble1 + nibble2)[::-1], 2))[2:].rjust(2, "0")
print("Hex10 Code: {}".format(result))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment