rustcrypt-ct-macros 0.1.0

Compile-time obfuscation macros for rustcrypt
Documentation
  • Coverage
  • 20%
    1 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 7.63 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 299.34 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ArthurBernard1/rustcrypt
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ArthurBernard1

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