Encryption algorithm used in WPA/WPA2 I want to know how EXACTLY the WPA password gets encrypted

I have been searching through and I was able to catch:


The actual password is converted to some hash
Salting is applied to the hash
The operation is not reversible
The hash comes with the 4-way handshake


So what kind of hash is it converted? like, SHA1? MD5? and how the salting process is done? like, is the SSID appended to the password before the hashing operation?

Or maybe I have some misunderstanding here?
A key is derived from the password using a Password Based Key Derivation Function, in this case PBKDF2:

Key = PBKDF2(HMAC−SHA1, passphrase, ssid, 4096, 256)


PBKDF2 in turn is described by PKCS#5. These RSA cryptographic standards in turn are made available through RFC's nowadays, in this case RFC 2898: PKCS #5: Password-Based Cryptography Specification Version 2.0.

In this case the password needs to be 8 to 63 characters in size. The characters are converted to binary using ASCII so you can only use characters in the (printable) character range of ASCII.

In PBKDF2 the binary password is used as key to the HMAC function. The salt is the SSID of the Wi-Fi connection. The salt + a counter value is used as the initial input to the HMAC function. After that the previous HMAC output is used as input, until 4096 HMAC rounds is reached. Unfortunately it seems that it outputs 256 bits while SHA-1 only output 160 bits. This means that you have to increase the counter once and do all the rounds all over again.

The output of the PBKDF2 function is the pre-shared key or PSK. The PSK is used directly as PMK (pairwise master key) in the 4-way handshake.

This is also described in section H.4 : Suggested pass-phrase-to-PSK mapping of IEEE 802.11i (2004) which is available for download from the IEEE web site.