Created
February 24, 2021 23:54
-
-
Save chancez/d7bdc9452dd5dfb6c4b97e57d74e3d3e to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import string | |
import sys | |
import hmac | |
import hashlib | |
def split_hex(value): | |
value = value[4:] if len(value) % 4 == 0 else "0" + value[4:] | |
return " ".join(value[i:i+4] for i in range(0, len(value), 4)) | |
SECRET = bytearray.fromhex('85 44 E3 B4 7E CA 58 F9 58 30 43 F8') | |
D = hmac.new(SECRET, digestmod=hashlib.sha1) | |
mac = bytearray.fromhex(sys.argv[1].replace(":", " ")) | |
D.update(mac) | |
y = D.hexdigest()[:24] | |
x = int(D.hexdigest()[:24], 16) | |
print(' '.join(y[i:i+4] for i in range(0, len(y), 4))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment