pub fn new(key: &str, pad: char) -> Self {
        assert_eq!(key.len(), 25, "`key` must be 25 chars in length");
        input::is_ascii(key).expect("`key` must be valid ascii");
        input::no_repeated_chars(key).expect("`key` cannot contain repeated chars");

        assert_ne!(key.find(pad), None, "`key` must contain `pad`");

        Self {
            key: String::from(key),
            pad: pad as u8,
        }
    }
/// Takes the key for the Playfair cipher and returns a corresponding
/// Playfair struct.
///
/// # Panics
/// * If `key` is not 25 chars in length.
/// * If `key` is not valid ascii.
/// * If `key` contains repeated characters.
/// * If `pad` is not contained within `key`.
Takes the key for the Playfair cipher and returns a corresponding
Playfair struct.
Takes the key for the Playfair cipher and returns a corresponding Playfair struct .
pub fn new(key: &str, pad: char) -> Self {
        assert_eq!(key.len(), 25, "`key` must be 25 chars in length");
        input::is_ascii(key).expect("`key` must be valid ascii");
        input::no_repeated_chars(key).expect("`key` cannot contain repeated chars");
        assert_ne!(key.find(pad), None, "`key` must contain `pad`");
        Self {
            key: String::from(key),
            pad: pad as u8,
        }
    }
pub fn new ( key : & str , pad : char ) -> Self { assert_eq ! ( key len ( ) 25 " " ) ; input :: is_ascii ( key ) . expect ( " " ) ; input :: no_repeated_chars ( key ) . expect ( " " ) ; assert_ne ! ( key find ( pad ) None " " ) ; Self { key : String :: from ( key ) , pad : pad as u8 , } }
Takes the key for the Playfair cipher and returns a corresponding
Playfair struct.
Takes the key for the Playfair cipher and returns a corresponding Playfair struct .
key
&str
pad
char
key
&str
pad
char
panics
If `key` is not 25 chars in length.
If `key` is not valid ascii.
If `key` contains repeated characters.
If `pad` is not contained within `key`.
If ` key ` is not 25 chars in length . If ` key ` is not valid ascii . If ` key ` contains repeated characters . If ` pad ` is not contained within ` key ` .