mirror of
https://github.com/moparisthebest/ImageDownloader
synced 2024-11-21 08:45:04 -05:00
More rust tweaks
This commit is contained in:
parent
11339ab525
commit
760d14d160
@ -33,7 +33,7 @@ fn encrypt(data: &[u8], key: &[u8], iv: &[u8]) -> Vec<u8> {
|
|||||||
let mut out: Vec<u8> = vec![0; data.len()];
|
let mut out: Vec<u8> = vec![0; data.len()];
|
||||||
let mut out_tag: Vec<u8> = vec![0; 16];;
|
let mut out_tag: Vec<u8> = vec![0; 16];;
|
||||||
|
|
||||||
encryptor.encrypt(&*data, &mut out[..],&mut out_tag[..]);
|
encryptor.encrypt(&*data, &mut *out,&mut *out_tag);
|
||||||
|
|
||||||
out.extend_from_slice(&out_tag);
|
out.extend_from_slice(&out_tag);
|
||||||
return out
|
return out
|
||||||
@ -60,7 +60,7 @@ fn decrypt(encrypted_data: &[u8], key: &[u8], iv: &[u8]) -> Result<Vec<u8>, &'st
|
|||||||
let out_len = encrypted_data.len() - 16;
|
let out_len = encrypted_data.len() - 16;
|
||||||
let mut out: Vec<u8> = vec![0; out_len];;
|
let mut out: Vec<u8> = vec![0; out_len];;
|
||||||
|
|
||||||
let result = decryptor.decrypt(&encrypted_data[0..out_len], &mut out[..], &encrypted_data[out_len..]);
|
let result = decryptor.decrypt(&encrypted_data[0..out_len], &mut *out, &encrypted_data[out_len..]);
|
||||||
if result {
|
if result {
|
||||||
Ok(out)
|
Ok(out)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user