Function obfstr::xref

source · []
pub fn xref<T: ?Sized>(p: &'static T, offset: usize) -> &'static T
Expand description

Obfuscates the xref to static data.

The offset can be initialized with [random!] for a compiletime random value.

static FOO: i32 = 42;
let foo = obfstr::xref(&FOO, 0x123);

// When looking at the disassembly the reference to `FOO` has been obfuscated.
assert_eq!(foo as *const _, &FOO as *const _);