pub trait Encryptable: WriteBytes {
// Provided methods
fn encrypt(&mut self, data: &[u8], pfh_version: PFHVersion) -> Result<()> { ... }
fn encrypt_u32(&mut self, value: u32, second_key: u32) -> Result<()> { ... }
fn encrypt_string(&mut self, path: &str, second_key: u8) -> Result<()> { ... }
}Expand description
Trait for encrypting PackFile data.
This trait provides the inverse operations of Decryptable, writing the encrypted
data into the implementor.
§Implementation
This trait is automatically implemented for any type that implements WriteBytes.
Provided Methods§
Sourcefn encrypt(&mut self, data: &[u8], pfh_version: PFHVersion) -> Result<()>
fn encrypt(&mut self, data: &[u8], pfh_version: PFHVersion) -> Result<()>
Encrypts the data of a PackedFile and writes it.
Data is encrypted in 8-byte chunks using the DATA_KEY. Trailing bytes that don’t fill a full chunk are written unencrypted.
§Arguments
data- The plain data to encrypt.pfh_version- The version of the Pack the data is for. Determines the width of the position term in the key.
§Errors
Returns an error if writing fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".