在阅读了WPA2中最近公开的bug后,我试图在Python中计算成对主密钥标识符(PMKID)。在链接中,用于计算PMKID的给定逻辑语句:
PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)
我为实现此目的所做的尝试:
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)
pmkid = hmac.new(pmk, "PMK Name"+apmac+clmac, hashlib.sha1).hexdigest()
print "Calculated hash: "+pmkid
但这给了我错误的哈希值。我尝试过其他方法,但是没有机会。有人可以向我解释我要去哪里错吗?