Created
November 15, 2016 15:24
-
-
Save otms61/297be364274cfb2710841befc742499e to your computer and use it in GitHub Desktop.
yubico modhex
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
d = { | |
'b': '1', | |
'c': '0', | |
'd': '2', | |
'e': '3', | |
'f': '4', | |
'g': '5', | |
'h': '6', | |
'i': '7', | |
'j': '8', | |
'k': '9', | |
'l': 'a', | |
'n': 'b', | |
'r': 'c', | |
't': 'd', | |
'u': 'e', | |
'v': 'f' | |
} | |
rd = { | |
'0': 'c', | |
'1': 'b', | |
'2': 'd', | |
'3': 'e', | |
'4': 'f', | |
'5': 'g', | |
'6': 'h', | |
'7': 'i', | |
'8': 'j', | |
'9': 'k', | |
'a': 'l', | |
'b': 'n', | |
'c': 'r', | |
'd': 't', | |
'e': 'u', | |
'f': 'v' | |
} | |
def modhex2hex(x): | |
return ''.join([d[i] for i in x]) | |
def hex2modhex(x): | |
return ''.join([rd[i] for i in x]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment