small optimization

This commit is contained in:
uh wot 2021-08-23 18:55:33 +02:00
parent 87d41408c6
commit 88447c3593
Signed by: uhwot
GPG key ID: CB2454984587B781
4 changed files with 6 additions and 10 deletions

View file

@ -1,7 +1,5 @@
use wasm_bindgen::prelude::*;
use js_sys::Uint8Array;
use blowfish::Blowfish;
use aes::Aes128;
use block_modes::{BlockMode, Cbc, Ecb};
@ -32,9 +30,8 @@ impl Cipher {
Self { cipher: BfCbc::new_from_slices(&key, &[0, 1, 2, 3, 4, 5, 6, 7]).unwrap() }
}
pub fn decrypt_chunk(&self, chunk: &mut [u8]) -> Uint8Array {
let chunk = self.cipher.clone().decrypt(chunk).unwrap();
unsafe { Uint8Array::view(&chunk) }
pub fn decrypt_chunk(&self, chunk: &mut [u8]) {
self.cipher.clone().decrypt(chunk);
}
}