// Convert encrypted or decrypted 64-bit blocks back to a Vector of u8
// values, optionally removing the ANSI X9.23 padding (for the
// decryption case).
Convert encrypted or decrypted 64-bit blocks back to a Vector of u8
values, optionally removing the ANSI X9.23 padding (for the
decryption case).
Convert encrypted or decrypted 64 - bit blocks back to a Vector of u8 values optionally removing the ANSI X9 . 23 padding ( for the decryption case ) .
fn prepare_output(data: &Vec<u64>, remove_padding: bool) -> Vec<u8> {
    let mut result: Vec<u8> = Vec::with_capacity(data.len() * 8);
    for &n in data.iter() {
        for i in (0..8).rev() {
            let t: u8 = ((n & (0xFF << (i * 8))) >> (i * 8)) as u8;
            result.push(t);
        }
    }
    if remove_padding && result.len() > 0 {
        let pad_bytes = result.pop().unwrap();
        for _ in 1..pad_bytes {
            result.pop();
        }
    }
    return result;
}
fn prepare_output ( data : & Vec < u64 > , remove_padding : bool ) -> Vec < u8 > { let mut result : Vec < u8 > = Vec :: with_capacity ( data . len ( ) * 8 ) ; for & n in data . iter ( ) { for i in ( 0 .. 8 ) . rev ( ) { let t : u8 = ( ( n & ( 0xFF << ( i * 8 ) ) ) >> ( i * 8 ) ) as u8 ; result . push ( t ) ; } } if remove_padding && result . len ( ) > 0 { let pad_bytes = result . pop ( ) . unwrap ( ) ; for _ in 1 .. pad_bytes { result . pop ( ) ; } } return result ; }
Convert encrypted or decrypted 64-bit blocks back to a Vector of u8
values, optionally removing the ANSI X9.23 padding (for the
decryption case).
Convert encrypted or decrypted 64 - bit blocks back to a Vector of u8 values optionally removing the ANSI X9 . 23 padding ( for the decryption case ) .
data
&Vec<u64>
remove_padding
bool