from hashlib import pbkdf2_hmac password = '12345678' SSID = 'ssid' PMK = pbkdf2_hmac('sha1', str.encode(password), str.encode(SSID), 4096, 32).hex() print (PMK) # 'eaad613a6acdd119b76ba13a0bcdd1eab41330853eb24896bf30c6cf220b7159'