pub fn encrypt_user_data(
    b: &[u8],
    k: &[u8],
    iv: &[u8],
) -> Result<Vec<u8>, symmetriccipher::SymmetricCipherError> {
    let mut user_data = Vec::new();

    for c in b {
        match c {
            b';' => {}
            b'=' => {}
            _ => user_data.push(*c),
        }
    }

    let mut plaintext = Vec::from("comment1=cooking%20MCs;userdata=");
    plaintext.extend_from_slice(&user_data);
    plaintext.extend_from_slice(b";comment2=%20like%20a%20pound%20of%20bacon");

    return crate::aes_cbc::encrypt_aes_128_cbc(&plaintext, k, iv);
}
/// encrypt_user_data is a helper function for CBC bitflipping attacks
///
/// Solution for problem 8 from set 2: <https://cryptopals.com/sets/2/challenges/16>
encrypt_user_data is a helper function for CBC bitflipping attacks
Solution for problem 8 from set 2.
encrypt_user_data is a helper function for CBC bitflipping attacks Solution for problem 8 from set 2 .
pub fn encrypt_user_data(
    b: &[u8],
    k: &[u8],
    iv: &[u8],
) -> Result<Vec<u8>, symmetriccipher::SymmetricCipherError> {
    let mut user_data = Vec::new();
    for c in b {
        match c {
            b';' => {}
            b'=' => {}
            _ => user_data.push(*c),
        }
    }
    let mut plaintext = Vec::from("comment1=cooking%20MCs;userdata=");
    plaintext.extend_from_slice(&user_data);
    plaintext.extend_from_slice(b";comment2=%20like%20a%20pound%20of%20bacon");
    return crate::aes_cbc::encrypt_aes_128_cbc(&plaintext, k, iv);
}
pub fn encrypt_user_data ( b : & [ u8 ] , k : & [ u8 ] , iv : & [ u8 ] , ) -> Result < Vec < u8 > , symmetriccipher :: SymmetricCipherError > { let mut user_data = Vec :: new ( ) ; for c in b { match c { b';' => { } b'=' => { } _ => user_data . push ( * c ) , } } let mut plaintext = Vec :: from ( " " ) ; plaintext . extend_from_slice ( & user_data ) ; plaintext . extend_from_slice ( b" " ) ; return crate :: aes_cbc :: encrypt_aes_128_cbc ( & plaintext , k , iv ) ; }
encrypt_user_data is a helper function for CBC bitflipping attacks
Solution for problem 8 from set 2: <https://cryptopals.com/sets/2/challenges/16>
encrypt_user_data is a helper function for CBC bitflipping attacks Solution for problem 8 from set 2 : <https : // cryptopals . com / sets / 2 / challenges / 16 >
b
&[u8]
k
&[u8]
iv
&[u8]