style(p4, p9): fix style issue
This commit is contained in:
@@ -13,10 +13,10 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
// 对密文的每个字节应用异或操作,得到明文
|
||||
let plaintext: Vec<u8> = cipher_bytes.iter().map(|&byte| byte ^ key).collect();
|
||||
for i in 0..=(plaintext.iter().len() - window_size) {
|
||||
if let Ok(text) = std::str::from_utf8(&plaintext[i..i + window_size]) {
|
||||
if is_valid_english(text, None) {
|
||||
println!("Found valid sentence with key {key}: {text}");
|
||||
}
|
||||
if let Ok(text) = std::str::from_utf8(&plaintext[i..i + window_size])
|
||||
&& is_valid_english(text, None)
|
||||
{
|
||||
println!("Found valid sentence with key {key}: {text}");
|
||||
}
|
||||
}
|
||||
// 尝试将字节转换为字符串
|
||||
|
||||
@@ -15,6 +15,7 @@ fn pkcs7_padding(data: &mut Vec<u8>, block_size: usize) {
|
||||
data.extend(vec![padding_length as u8; padding_length]);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn pkcs7_unpadding(input: &[u8]) -> Result<Vec<u8>> {
|
||||
if input.is_empty() {
|
||||
return Err(anyhow!("Input cannot be empty"));
|
||||
|
||||
Reference in New Issue
Block a user