[qmc] feat: add helper method to create QMCv2 Decipher from EKey

This commit is contained in:
鲁树人 2024-09-15 16:18:48 +01:00
parent 7502b310d2
commit 07fe0263d2

View File

@ -35,6 +35,11 @@ impl QMCv2Cipher {
Ok(cipher)
}
pub fn new_from_ekey<T: AsRef<[u8]>>(ekey_str: T) -> Result<Self> {
let key = ekey::decrypt(ekey_str)?;
Self::new(key)
}
pub fn decrypt<T>(&self, data: &mut T, offset: usize)
where
T: AsMut<[u8]> + ?Sized,