1
0

chore: use is_multiple_of()

This commit is contained in:
2025-10-20 23:49:52 +08:00
parent 2beb0e8ce9
commit c39eb53c0d

View File

@@ -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<Vec<u8>> {
if input.len() % 16 != 0 {
if !input.len().is_multiple_of(16) {
return Err(anyhow!("Invalid input length"));
}
let mut cipher: Vec<u8> = Vec::new();
@@ -41,7 +41,7 @@ fn aes_cbc_enc(input: &[u8], key: &[u8; 16], iv: &[u8; 16]) -> Result<Vec<u8>> {
}
fn aes_cbc_dec(input: &[u8], key: &[u8; 16], iv: &[u8; 16]) -> Result<Vec<u8>> {
if input.len() % 16 != 0 {
if !input.len().is_multiple_of(16) {
return Err(anyhow!("Invalid input length"));
}