Skip to content

Instantly share code, notes, and snippets.

@chancez
Created February 24, 2021 23:54
Show Gist options
  • Save chancez/d7bdc9452dd5dfb6c4b97e57d74e3d3e to your computer and use it in GitHub Desktop.
Save chancez/d7bdc9452dd5dfb6c4b97e57d74e3d3e to your computer and use it in GitHub Desktop.
#!/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