Created
November 18, 2022 12:56
-
-
Save rajkosto/29c513b96ea6262d2fb1f965a52ce16f to your computer and use it in GitHub Desktop.
Revisions
-
rajkosto created this gist
Nov 18, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/usr/bin/env python3 #ODI DFP-34X-2C2 MAC_KEY key generator by rajkosto import sys import string import hashlib args = sys.argv if len(args) != 2: sys.exit("Usage: odi_keygen.py YOURMACADDR") macAddr = args[1].strip().replace(':','') if len(macAddr) != 12: sys.exit("Mac address must be 12 hex digits (6 bytes)") if not all(c in string.hexdigits for c in macAddr): sys.exit("Mac address can only contain 0-9, A-F characters (hex digits)") cmacPrefix = 'hsgq1.9a' hashText = cmacPrefix+macAddr.upper() encodedText = hashText.encode('ascii') md5Hash = hashlib.md5(encodedText).digest().hex() print('ELAN_MAC_ADDR='+macAddr.lower()) print('MAC_KEY='+md5Hash.lower())