Crate wpa_psk

source ·
Expand description

Compute the WPA-PSK of a Wi-Fi SSID and passphrase.

§Example

Compute and print the WPA-PSK of a valid SSID and passphrase:

let ssid = Ssid::try_from("home")?;
let passphrase = Passphrase::try_from("0123-4567-89")?;
let psk = wpa_psk(&ssid, &passphrase);
assert_eq!(bytes_to_hex(&psk), "150c047b6fad724512a17fa431687048ee503d14c1ea87681d4f241beb04f5ee");

Compute the WPA-PSK of possibly invalid raw bytes:

let ssid = "bar".as_bytes();
let passphrase = "2short".as_bytes();
let psk = wpa_psk_unchecked(&ssid, &passphrase);
assert_eq!(bytes_to_hex(&psk), "cb5de4e4d23b2ab0bf5b9ba0fe8132c1e2af3bb52298ec801af8ad520cea3437");

Structs§

  • A passphrase consisting of 8 up to 63 printable ASCII characters.
  • An SSID consisting of 1 up to 32 arbitrary bytes.

Enums§

Functions§