pub fn decrypt_user_data(b: &[u8], k: &[u8], nonce: &[u8]) -> Result<bool, crate::Error> {
    let plaintext = crate::aes_ctr::aes_128_ctr(b, k, nonce).unwrap();
    let mut plaintext = String::from_utf8_lossy(&plaintext);

    let mut iter = plaintext.split(";");
    let mut contains = false;

    loop {
        match iter.next() {
            Some(inner_kv) => {
                if inner_kv == "admin=true" {
                    return Ok(true);
                }
            }
            None => return Ok(false),
        };
    }
}
/// decrypt_user_data is a helper function for CTR bitflipping attacks
///
/// Solution for problem 2 from set 4: <https://cryptopals.com/sets/4/challenges/26>
decrypt_user_data is a helper function for CTR bitflipping attacks
Solution for problem 2 from set 4.
decrypt_user_data is a helper function for CTR bitflipping attacks Solution for problem 2 from set 4 .
pub fn decrypt_user_data(b: &[u8], k: &[u8], nonce: &[u8]) -> Result<bool, crate::Error> {
    let plaintext = crate::aes_ctr::aes_128_ctr(b, k, nonce).unwrap();
    let mut plaintext = String::from_utf8_lossy(&plaintext);
    let mut iter = plaintext.split(";");
    let mut contains = false;
    loop {
        match iter.next() {
            Some(inner_kv) => {
                if inner_kv == "admin=true" {
                    return Ok(true);
                }
            }
            None => return Ok(false),
        };
    }
}
pub fn decrypt_user_data ( b : & [ u8 ] , k : & [ u8 ] , nonce : & [ u8 ] ) -> Result < bool , crate :: Error > { let plaintext = crate :: aes_ctr :: aes_128_ctr ( b , k , nonce ) . unwrap ( ) ; let mut plaintext = String :: from_utf8_lossy ( & plaintext ) ; let mut iter = plaintext . split ( " " ) ; let mut contains = false ; loop { match iter . next ( ) { Some ( inner_kv ) => { if inner_kv == " " { return Ok ( true ) ; } } None => return Ok ( false ) , } ; } }
decrypt_user_data is a helper function for CTR bitflipping attacks
Solution for problem 2 from set 4: <https://cryptopals.com/sets/4/challenges/26>
decrypt_user_data is a helper function for CTR bitflipping attacks Solution for problem 2 from set 4 : <https : // cryptopals . com / sets / 4 / challenges / 26 >
b
&[u8]
k
&[u8]
nonce
&[u8]