fn repeat_key(mut key: Vec<AsciiUppercaseByte>, target_length: usize) -> Vec<AsciiUppercaseByte> {
    if target_length == key.len() {
        key
    }
    else if target_length < key.len() {
        key.truncate(target_length);
        key
    }
    else {
        let original_key_length = key.len();
        let mut key_counter = 0usize;

        while target_length > key.len() {
            key.push(key[key_counter]);
            key_counter = (key_counter + 1) % original_key_length;
        }
        key
    }
}
// Repeat the key so that its length matches `target_length`
Repeat the key so that its length matches `target_length`
Repeat the key so that its length matches ` target_length `
fn repeat_key(mut key: Vec<AsciiUppercaseByte>, target_length: usize) -> Vec<AsciiUppercaseByte> {
    if target_length == key.len() {
        key
    }
    else if target_length < key.len() {
        key.truncate(target_length);
        key
    }
    else {
        let original_key_length = key.len();
        let mut key_counter = 0usize;
        while target_length > key.len() {
            key.push(key[key_counter]);
            key_counter = (key_counter + 1) % original_key_length;
        }
        key
    }
}
fn repeat_key ( mut key : Vec < AsciiUppercaseByte > , target_length : usize ) -> Vec < AsciiUppercaseByte > { if target_length == key . len ( ) { key } else if target_length < key . len ( ) { key . truncate ( target_length ) ; key } else { let original_key_length = key . len ( ) ; let mut key_counter = 0usize ; while target_length > key . len ( ) { key . push ( key [ key_counter ] ) ; key_counter = ( key_counter + 1 ) % original_key_length ; } key } }
Repeat the key so that its length matches `target_length`
Repeat the key so that its length matches ` target_length `
key
Vec<AsciiUppercaseByte>
target_length
usize
key
Vec<AsciiUppercaseByte>
target_length
usize