muddy!() { /* proc-macro */ }Expand description
Obfuscates a literal text. The generated code will provide checks against multiple evaluations.
§Example
ⓘ
fn f() -> &'static str {
muddy!("supersecret1")
}
for _ in 0..2 {
println!("{}", f());
}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!(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!(env = "MY_ENV", "my text")); // will provide the generated deobfuscation key
// at build time
// `MY_ENV='<SOME_KEY>'`