10 releases
0.2.3 | Mar 6, 2024 |
---|---|
0.2.2 | Mar 14, 2023 |
0.2.1 | Feb 16, 2023 |
0.2.0 | May 28, 2022 |
0.1.0 | Jan 3, 2022 |
#601 in Algorithms
Used in wpa-psk-cli
8KB
128 lines
wpa-psk
This is a Rust library to compute the WPA pre-shared key of a Wi-Fi SSID and
passphrase. See also the corresponding command-line interface wpa-psk-cli
.
See the crate documentation for more information.
License
This work is distributed under the terms of both, the MIT License and the Apache License, Version 2.0.
Contribution
Contributions are welcome! Please contact me via email.
lib.rs
:
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");
Dependencies
~495KB
~10K SLoC