/// Derives a WEP key from the given input.
/// The input can be either in ASCII or hex representation.
/// The key length is derived from the input length.
/// WEP-40 and WEP-104 is supported.
/// Returns an Error if WEP support is disabled.
Derives a WEP key from the given input.
The input can be either in ASCII or hex representation.
The key length is derived from the input length.
WEP-40 and WEP-104 is supported.
Returns an Error if WEP support is disabled.
Derives a WEP key from the given input . The input can be either in ASCII or hex representation . The key length is derived from the input length . WEP - 40 and WEP - 104 is supported . Returns an Error if WEP support is disabled .
pub fn derive_key(input: &[u8]) -> Result<Key, Error> {
    if !is_supported() {
        return Err(Error::NotSupported);
    }
    match input.len() {
        // WEP-40:
        5 => Ok(Key::Bits40(to_array(input))),
        10 => <[u8; 5]>::from_hex(input).map(Key::Bits40).map_err(Error::InvalidHexInput),
        // WEP-104:
        13 => Ok(Key::Bits104(to_array(input))),
        26 => <[u8; 13]>::from_hex(input).map(Key::Bits104).map_err(Error::InvalidHexInput),
        _ => Err(Error::InvalidInputLength),
    }
}
pub fn derive_key ( input : & [ u8 ] ) -> Result < Key , Error > { if ! is_supported ( ) { return Err ( Error :: NotSupported ) ; } match input . len ( ) { // WEP-40: 5 => Ok ( Key :: Bits40 ( to_array ( input ) ) ) , 10 => < [ u8 ; 5 ] > :: from_hex ( input ) . map ( Key :: Bits40 ) . map_err ( Error :: InvalidHexInput ) , // WEP-104: 13 => Ok ( Key :: Bits104 ( to_array ( input ) ) ) , 26 => < [ u8 ; 13 ] > :: from_hex ( input ) . map ( Key :: Bits104 ) . map_err ( Error :: InvalidHexInput ) , _ => Err ( Error :: InvalidInputLength ) , } }
Derives a WEP key from the given input.
Derives a WEP key from the given input .
input
&[u8]