Key_data = min(ap_mac,s_mac) + max(ap_mac,s_mac) + min(anonce,snonce) + max(anonce,snonce) Sample python code for generating the keys: pmk = hashlib.pbkdf2_hmac('sha1', passphrase, SSID.encode(), 4096, 32) PTK can be generated with a function (customPRF512) or simply by calling hmac lib. 64 bits- MIC Authenticator Rx Key (MIC Rx) – Only used with TKIP configurations for unicast packets sent by clients.
The result is 512bit PTK which are treated as 5 separate keys: PTK is dependent on ANOUNCE, SNOUNCE, AP & Station MAC Addresses and PMK. Print 'Pairwise Master Key (PMK): ' + PBKDF2(phrase, ssid, 4096).read(32).encode('hex')) The 4096 iterations to create 256 bit PMK with SSID used as salt and PSK (passphrase) used as the base of entire process.