pub struct Rar5Crypto { /* private fields */ }Expand description
RAR5 cryptographic operations.
Implementations§
Source§impl Rar5Crypto
impl Rar5Crypto
Sourcepub fn derive_key(password: &str, salt: &[u8; 16], lg2_count: u8) -> Self
pub fn derive_key(password: &str, salt: &[u8; 16], lg2_count: u8) -> Self
Derive key from password using PBKDF2-HMAC-SHA256.
RAR5 derives 3 values:
- Key (32 bytes) - for AES-256 encryption
- Hash key (32 bytes) - for MAC checksums (iterations + 16)
- Password check (32 bytes) - for password verification (iterations + 32)
Sourcepub fn verify_password(&self, expected: &[u8; 8]) -> bool
pub fn verify_password(&self, expected: &[u8; 8]) -> bool
Verify password using the stored check value.
Sourcepub fn decrypt(&self, iv: &[u8; 16], data: &mut [u8]) -> Result<(), CryptoError>
pub fn decrypt(&self, iv: &[u8; 16], data: &mut [u8]) -> Result<(), CryptoError>
Decrypt data in-place using AES-256-CBC.
Sourcepub fn decrypt_to_vec(
&self,
iv: &[u8; 16],
data: &[u8],
) -> Result<Vec<u8>, CryptoError>
pub fn decrypt_to_vec( &self, iv: &[u8; 16], data: &[u8], ) -> Result<Vec<u8>, CryptoError>
Decrypt data to a new buffer.
Trait Implementations§
Source§impl Clone for Rar5Crypto
impl Clone for Rar5Crypto
Source§fn clone(&self) -> Rar5Crypto
fn clone(&self) -> Rar5Crypto
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Rar5Crypto
impl RefUnwindSafe for Rar5Crypto
impl Send for Rar5Crypto
impl Sync for Rar5Crypto
impl Unpin for Rar5Crypto
impl UnwindSafe for Rar5Crypto
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more