Skip to content

Instantly share code, notes, and snippets.

@otms61
Created November 15, 2016 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otms61/297be364274cfb2710841befc742499e to your computer and use it in GitHub Desktop.
Save otms61/297be364274cfb2710841befc742499e to your computer and use it in GitHub Desktop.
yubico modhex
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