diff --git a/problems/p10/src/main.rs b/problems/p10/src/main.rs index cf13814..b6fcdca 100644 --- a/problems/p10/src/main.rs +++ b/problems/p10/src/main.rs @@ -8,7 +8,7 @@ use common::{ use std::fs::read_to_string; fn aes_cbc_enc(input: &[u8], key: &[u8; 16], iv: &[u8; 16]) -> Result> { - if input.len() % 16 != 0 { + if !input.len().is_multiple_of(16) { return Err(anyhow!("Invalid input length")); } let mut cipher: Vec = Vec::new(); @@ -41,7 +41,7 @@ fn aes_cbc_enc(input: &[u8], key: &[u8; 16], iv: &[u8; 16]) -> Result> { } fn aes_cbc_dec(input: &[u8], key: &[u8; 16], iv: &[u8; 16]) -> Result> { - if input.len() % 16 != 0 { + if !input.len().is_multiple_of(16) { return Err(anyhow!("Invalid input length")); }