pub fn pad(msg: &mut Vec<u8>, block_len: usize) {
    // Check for illegal block_len.
    if block_len < 2 || block_len > 255 {
        panic!("Illegal block length ({:?}); must be between 1-255.", 
            block_len);
    }

    let rem = msg.len() % block_len;
    let pad_bytes : u8 = (block_len - rem) as u8;

    for _ in 0..pad_bytes {
        msg.push(pad_bytes);
    }
}
// Pads a message to a multiple of block_len using PKCS7: pads the
// message with bytes that indicate the number of padding bytes
// that are added. 
// block_len must be [2,255] or this fn panic!s.
Pads a message to a multiple of block_len using PKCS7: pads the
message with bytes that indicate the number of padding bytes
that are added.
block_len must be [2,255] or this fn panic!s.
Pads a message to a multiple of block_len using PKCS7 : pads the message with bytes that indicate the number of padding bytes that are added . block_len must be [ 2 255 ] or this fn panic!s .
pub fn pad(msg: &mut Vec<u8>, block_len: usize) {
    // Check for illegal block_len.
    if block_len < 2 || block_len > 255 {
        panic!("Illegal block length ({:?}); must be between 1-255.", 
            block_len);
    }
    let rem = msg.len() % block_len;
    let pad_bytes : u8 = (block_len - rem) as u8;
    for _ in 0..pad_bytes {
        msg.push(pad_bytes);
    }
}
pub fn pad ( msg : & mut Vec < u8 > , block_len : usize ) { // Check for illegal block_len. if block_len < 2 || block_len > 255 { panic ! ( " " block_len ) ; } let rem = msg . len ( ) % block_len ; let pad_bytes : u8 = ( block_len - rem ) as u8 ; for _ in 0 .. pad_bytes { msg . push ( pad_bytes ) ; } }
Pads a message to a multiple of block_len using PKCS7: pads the
message with bytes that indicate the number of padding bytes
that are added.
Pads a message to a multiple of block_len using PKCS7 : pads the message with bytes that indicate the number of padding bytes that are added .
msg
&mut Vec<u8>
block_len
usize
msg
&mut Vec<u8>
block_len
usize