feat: optimize code

This commit is contained in:
2023-10-15 21:43:02 +08:00
parent eda2d94d21
commit 47a0625dcc
4 changed files with 15 additions and 7 deletions

View File

@@ -136,7 +136,8 @@ pub fn decrypt_single(config: &Option<TinyEncryptConfig>,
Ok(meta.file_length)
}
fn decrypt_file(file_in: &mut File, file_len: u64, file_out: &mut File, key: &[u8], nonce: &[u8], compress: bool) -> XResult<u64> {
fn decrypt_file(file_in: &mut File, file_len: u64, file_out: &mut File,
key: &[u8], nonce: &[u8], compress: bool) -> XResult<u64> {
let mut total_len = 0_u64;
let mut buffer = [0u8; 1024 * 8];
let key = opt_result!(key.try_into(), "Key is not 32 bytes: {}");