I am trying to implement a function, let's say in Python to compute Pairwise Master Key Identifier (PMKID) after reading the previously discovered bug in WPA2. Googling gave me this logical statement:
PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)
However, the problem is i am not able to compute the right hash. I've tried various possibilities, tried converting data to binary, tried various versions of MAC but still no chance.
The Question is how do I implement the function for computing PMKID, preferably in Python. Here's what i've doing a bit:
import hashlib, binascii, hmac from pbkdf2 import PBKDF2 print "Required hash: 2a416a999af0a6bf454684269afb06ef" apmac = '34:bf:90:4a:bb:57' clmac = '98:de:d0:1a:97:c2' pmk = PBKDF2('786 5555', 'unknown', 4096).read(32) print "PMK: "+binascii.hexlify(pmk) pmkid = hmac.new(pmk, "PMK Name"+apmac+clmac, hashlib.sha1).hexdigest() print pmkid