rustcrypt-ct-macros

Crates.iorustcrypt-ct-macros
lib.rsrustcrypt-ct-macros
version0.1.0
created_at2025-09-10 17:06:19.926313+00
updated_at2025-09-10 17:06:19.926313+00
descriptionCompile-time obfuscation macros for rustcrypt
homepage
repositoryhttps://github.com/ArthurBernard1/rustcrypt
max_upload_size
id1832737
size7,633
Arthur Bernard (ArthurBernard1)

documentation

README

rustcrypt-ct-macros

Procedural macros for rustcrypt providing compile-time obfuscation helpers:

  • obf_lit!("text") -> String
  • obf_lit_bytes!(b"bytes") -> Vec
  • obf_lit_cstr!("nul\0terminated") -> Vec (includes trailing nul)
  • obf_lit_array!(b"raw") -> ([u8; N], [u8; N])

These macros emit obfuscated arrays and perform XOR at runtime to recover data with minimal overhead.

Usage

Add to your Cargo.toml:

[dependencies]
rustcrypt = "0.2.0-beta.1"

Then in code:

use rustcrypt::{obf_lit, obf_lit_bytes, obf_lit_cstr, obf_lit_array};

fn main() {
    let s = obf_lit!("hello");
    let b = obf_lit_bytes!(b"bytes");
    let c = obf_lit_cstr!("zero\0term");
    let (obf, key) = obf_lit_array!(b"raw");
    let _ = (s, b, c, obf, key);
}

License: MIT

Commit count: 11

cargo fmt