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§
- Passphrase
- A passphrase consisting of 8 up to 63 printable ASCII characters.
- Ssid
- An SSID consisting of 1 up to 32 arbitrary bytes.
Enums§
- Validate
Passphrase Error - Passphrase validation error.
- Validate
Ssid Error - SSID validation error.
Functions§
- bytes_
to_ hex - Returns the hexdecimal representation of the given bytes.
- wpa_psk
- Returns the WPA-PSK of the given SSID and passphrase.
- wpa_
psk_ unchecked - Unchecked WPA-PSK.
See
wpa_psk
.