encrypt_in_place

Function encrypt_in_place 

Source
pub fn encrypt_in_place(file_content: &mut [u8], key: &str) -> Result<(), Error>
Expand description

Encrypts file content in-place using a key string and a temporary Decrypter instance.

This is a convenience wrapper around Decrypter::encrypt_in_place. A new Decrypter is created internally, and the key is set from the provided string.

This function modifies the file data directly and produces only the encrypted payload. The RPG Maker encryption header is not added automatically; it must be prepended manually if producing a complete .rpgmvp, .rpgmvo, or .rpgmvw file.

If you do not want to modify data in-place, use encrypt instead.

§Arguments

  • file_content - The data of .png, .ogg or .m4a file.
  • key - Encryption key string.

§Returns

  • [Error] if key’s length is not 32 bytes.
  • Nothing otherwise.

§Errors