pub struct DesEncryptor { /* private fields */ }Expand description
DES Encryptor for encrypting and decrypting data using DES-ECB mode.
This is compatible with the C++ zus::DesEncrypt and Java CryptUtil implementations.
Implementations§
Source§impl DesEncryptor
impl DesEncryptor
Sourcepub fn decrypt(&self, data: &[u8]) -> Result<Vec<u8>>
pub fn decrypt(&self, data: &[u8]) -> Result<Vec<u8>>
Decrypt data using DES-ECB mode.
Note: The decrypted data may contain trailing zeros from padding. The caller should know the original data length to trim padding.
§Arguments
data- Encrypted data (length must be multiple of 8)
§Returns
- Decrypted data (same length as input, may contain padding zeros)
Sourcepub fn encrypt_in_place(&self, data: &mut Vec<u8>, offset: usize) -> Result<()>
pub fn encrypt_in_place(&self, data: &mut Vec<u8>, offset: usize) -> Result<()>
Encrypt data in-place starting from the given offset.
This matches the C++ DesEncrypt::Encrypt(std::string& data, offset) method.
§Arguments
data- Mutable data buffer (will be extended if necessary)offset- Starting offset for encryption
Trait Implementations§
Source§impl Clone for DesEncryptor
impl Clone for DesEncryptor
Source§fn clone(&self) -> DesEncryptor
fn clone(&self) -> DesEncryptor
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 DesEncryptor
impl RefUnwindSafe for DesEncryptor
impl Send for DesEncryptor
impl Sync for DesEncryptor
impl Unpin for DesEncryptor
impl UnwindSafe for DesEncryptor
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