Macro muddy_unchecked

Source
muddy_unchecked!() { /* proc-macro */ }
Expand description

Obfuscates a literal text. The generated code will NOT provide checks against multiple evaluations.

§Example

fn f() -> &'static str {
  muddy_unchecked!("supersecret1")
}

let plaintext = f();

for _ in 0..2 {
  println!("{}", plaintext);
}

This macro also takes in an optional env argument, with an optional value. If set, the deobfuscation key must be set at runtime, or the macro invocation will panic.

§Example

println!("{}", muddy_unchecked!(env, "my text")); // will provide the generated deobfuscation key
                                                  // at build time using the default 'MUDDY' key:
                                                  // `MUDDY='<SOME_KEY>'`

An alternative env key may be set by the caller:

§Example

println!("{}", muddy_unchecked!(env = "MY_ENV", "my text")); // will provide the generated deobfuscation key
                                                             // at build time
                                                             // `MY_ENV='<SOME_KEY>'`