From c39eb53c0dceda9fb5ca2289166a33834c63f87d Mon Sep 17 00:00:00 2001 From: sangge <2251250136@qq.com> Date: Mon, 20 Oct 2025 23:49:52 +0800 Subject: [PATCH] chore: use is_multiple_of() --- problems/p10/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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")); }