Last active
October 2, 2021 19:22
-
-
Save apostoloss/4d18858b0f97d701bac5db1f7007a451 to your computer and use it in GitHub Desktop.
small function to check if a string is yubikey or not just based on length and if all chars are in the 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
def isYubikey(string): | |
""" | |
Checks if a string looks like a yubikey. | |
Yubikey strings are exactly 44 characters and use modhex | |
""" | |
modhex = "cbdefghijklnrtuv" | |
if len(string) != 44: | |
return False | |
for i in string: | |
if i not in modhex: | |
return False | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment