Does the wpa_passphrase command turn an ASCII string into hexadecimal and what is the benefit of doing so? Is the psk sent in the header of packets? Can it be easy to sniff if it's in a string format?


1 Answer 1


The PSK is not 'converted' to hexadecimal but if doing the calculation by hand it is often expressed that way to simplify the process. As the manpage indicates,

wpa_passphrase pre-computes PSK entries for network configuration blocks of a wpa_supplicant.conf file. An ASCII passphrase and SSID are used to generate a 256-bit PSK

This means, you provided the passphrase and the ssid, which are two parts of the calculated SSID. The passphrase and SSID can be expressed as hexadecimal during the process if you want to think of it that way (its just a way of expressing the data, its not really a conversion) and they are used to compute a one way hash (using SHA) becoming the PSK, which is then used during the handshake (only after steps are taken to confirm the other side also knows the PSK in a similar one-way manner, part of the four way handshake). It is never sent in the clear to the extent that observation will do anything other than allow you to confirm that you have successfully guessed the passphrase.

Edit: more info requested

The WPA/WPA2 process is pretty intricate, here is a good question/answer that goes into more specifics about key handling. In summary though, the passphrase/password is never sent in the clear or even in a reversibly encrypted form, it is turned into a "preshared key" by using the passphrase + SSID and then computing a (theoretically) one-way hash, known as the PSK, which is used during the handshake and even that isn't sent in the clear (because it would allow a replay attack) so it is only communicated between client and host via further encryption steps.

  • Thank you for your great answer. To confirm my understanding, the passphrase the key in an encrypted form? Also, during the handshake, the password is never sent in plain text format?
    – cnic
    Jul 22, 2016 at 21:44
  • @cnic There are asymmetric methods of verifying a password that are irreversible. Often Diffie-Hellman key agreement is used as part of such algorithms. Jul 25, 2016 at 1:46
  • 4
    I upvoted, but it is still not clear what is the benefit of using wpa_passphrase command which turns for example P@$$w0rd into 8d240f2be9db8bba9dbd68d888fd43c7b3b00823ac9dd0d24b9b301a8fd255ec. It is clear that it is not Hash (or another sort of encryption) - it is just another encoding, different from ASCII. So what is the point of it? Why not to keep it in ASCII?
    – Drew
    Apr 7, 2018 at 4:29
  • I have a similar question as Drew. In particular I have struggled with getting my laptop connected at my home wlan, and I wrote a ruby script to automate the various different commands that have to be performed. Right now I also want to autogenerate the .conf file for wpa, but I don't know how to replace the password string + essid (which I both know since it is on my home system) into that strange hash. Any information added would be hugely helpful.
    – shevy
    May 2, 2019 at 11:32
  • @Drew good point, I think it is true. I see one benefit though. If you share same password between more networks, if somebody gets one passphrase, it will not help him to connect to other networks.
    – Flowy
    May 18, 2019 at 19:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .