pub fn decrypt(
file_content: &[u8],
file_type: FileType,
) -> Result<Vec<u8>, Error>Expand description
Decrypts RPG Maker file content using a temporary Decrypter instance.
This is a convenience wrapper around Decrypter::decrypt.
A new Decrypter is created internally, and the decryption key is
auto-determined from the provided file data.
This function copies the contents of the file and returns a decrypted Vec<u8>.
If you want to avoid copying, use decrypt_in_place instead.
§Arguments
file_content- The data of RPG Maker file.file_type-FileType, representing whether passed file content is PNG, OGG or M4A.
§Returns
- [
Error] if the passed data has an invalid header or ends unexpectedly. - Decrypted
Vec<u8>otherwise.
§Errors
Error::InvalidHeader– if the providedfile_contentdoes not start with the RPG Maker header.Error::UnexpectedEOF– if the data ends unexpectedly.