Hex WEP keys are of even length, ASCII keys are of odd length. Using this information we make wifi-menu work better for WEP networks. Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com> --- src/lib/wpa | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/wpa b/src/lib/wpa index d79fdbe..ff6d9ab 100644 --- a/src/lib/wpa +++ b/src/lib/wpa @@ -219,11 +219,15 @@ wpa_make_config_block() { wep) echo "key_mgmt=NONE" echo "wep_tx_keyidx=0" - echo "wep_key0=$(wpa_quote "$Key")" + if (( ${#Key} % 2 == 0 )) && [[ "$key" = +([[:xdigit:]]) ]]; then + echo "wep_key0=$Key" + else + echo "wep_key0=$(wpa_quote "$Key")" + fi ;; wpa) echo "proto=RSN WPA" - if [[ "${#Key}" -eq 64 ]]; then + if [[ "${#key}" -eq 64 && "$key" = +([[:xdigit:]]) ]]; then echo "psk=$Key" else echo "psk=$(wpa_quote "$Key")" -- 1.8.4.1