pub fn encipher(keyphrase: &[u8], plain_text: &[u8]) -> Result<String, Error> {
    // Step 1
    let key = create_key(&sanitize_text(keyphrase)?);

    let plain_text = sanitize_text(plain_text)?;

    let mut tagged_text = Vec::new();

    // Step 2: Tag every character in the plan text with its column number
    for (idx, &p) in plain_text.iter().enumerate() {
        tagged_text.push((key[idx % key.len()], p));
    }

    // Step 3 & 4
    tagged_text.sort_by_key(|k| k.0);

    let enciphered = tagged_text.iter().map(|x| x.1).collect::<Vec<AsciiUppercaseByte>>();

    Ok(format_output(enciphered))
}
/// Enciphers `plain_text` with `keyphrase` using regular column transposition
Enciphers `plain_text` with `keyphrase` using regular column transposition
Enciphers ` plain_text ` with ` keyphrase ` using regular column transposition
pub fn encipher(keyphrase: &[u8], plain_text: &[u8]) -> Result<String, Error> {
    // Step 1
    let key = create_key(&sanitize_text(keyphrase)?);
    let plain_text = sanitize_text(plain_text)?;
    let mut tagged_text = Vec::new();
    // Step 2: Tag every character in the plan text with its column number
    for (idx, &p) in plain_text.iter().enumerate() {
        tagged_text.push((key[idx % key.len()], p));
    }
    // Step 3 & 4
    tagged_text.sort_by_key(|k| k.0);
    let enciphered = tagged_text.iter().map(|x| x.1).collect::<Vec<AsciiUppercaseByte>>();
    Ok(format_output(enciphered))
}
pub fn encipher ( keyphrase : & [ u8 ] , plain_text : & [ u8 ] ) -> Result < String , Error > { // Step 1 let key = create_key ( & sanitize_text ( keyphrase ) ? ) ; let plain_text = sanitize_text ( plain_text ) ? ; let mut tagged_text = Vec :: new ( ) ; // Step 2: Tag every character in the plan text with its column number for ( idx , & p ) in plain_text . iter ( ) . enumerate ( ) { tagged_text . push ( ( key [ idx % key . len ( ) ] , p ) ) ; } // Step 3 & 4 tagged_text . sort_by_key ( | k | k . 0 ) ; let enciphered = tagged_text . iter ( ) . map ( | x | x . 1 ) . collect :: < Vec < AsciiUppercaseByte > > ( ) ; Ok ( format_output ( enciphered ) ) }
Enciphers `plain_text` with `keyphrase` using regular column transposition
Enciphers ` plain_text ` with ` keyphrase ` using regular column transposition
keyphrase
&[u8]
plain_text
&[u8]
keyphrase
&[u8]
plain_text
&[u8]