Function libxivdat::dat_type::get_mask_for_type[][src]

pub fn get_mask_for_type(file_type: &DATType) -> Option<u8>
Expand description

Gets the XOR mask used for the contents of a binary DAT file. The mask is applied to only the file data content, not the header, footer, or padding null bytes. Returns None if the file is of unknown type or does not have a mask.

Examples

use libxivdat::dat_type::{DATType, get_mask_for_type};

let mask = get_mask_for_type(&DATType::Macro).unwrap();
for byte in raw_macro_bytes.iter_mut() {
   *byte = *byte ^ mask;
}