| Crates.io | rust-native-obf |
| lib.rs | rust-native-obf |
| version | 0.1.1 |
| created_at | 2025-10-07 10:27:44.154289+00 |
| updated_at | 2025-10-07 20:25:36.678189+00 |
| description | advanced native obfuscation library for rust |
| homepage | |
| repository | https://github.com/ege0x77czz/rust-native-obf |
| max_upload_size | |
| id | 1871461 |
| size | 30,949 |
advanced native obfuscation library for rust
compile time obfuscation
runtime obfuscation
advanced techniques
[dependencies]
rust-native-obf = "0.1.0"
use rust_native_obf::*;
let secret = obf_str!("my secret key");
let bytes = obf_bytes!(b"secret data");
let wide = obf_wide!("wide string");
let hash = ct_xxhash!(b"data");
let random = ct_rand!(u32);
let encoded = obf_const!(42, u32);
let result = hidden_call!({
sensitive_function()
});
obf_if!(condition, {
do_something();
}, {
do_else();
});
static DATA: [u8; 4] = [1, 2, 3, 4];
let obf_ref = obf_static_ref!(&DATA);
let obf_val = ObfuscatedValue::new(123456);
let original = obf_val.get();
let encrypted = cascade_encrypt(data, 5);
debug_trap!();
if !anti_debug() {
panic!("debugger detected");
}
cargo run --example basic
string obfuscation - uses pcg random number generator for keystream generation, encrypts at compile time, decrypts with volatile reads to prevent constant folding
control flow - generates unique keys for each code block based on statement content, executes in randomized order
value encoding - uses mixed boolean arithmetic (mba) with rotation and multiplication for reversible encoding
pointer obfuscation - mangles static references using xxhash-based transformation with black_box to prevent llvm optimization
compile time rng - combines file location, line number, column with xxhash mixing and siphash for deterministic randomness
anti-debug - checks for debugger presence on windows, can be extended for other platforms
this is obfuscation, not cryptography. designed to make reverse engineering harder, not impossible. do not use for hiding actual secrets in client binaries.
MIT