chore: use is_multiple_of()
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user