#string #macro #encryption #xor #decode #encryption-macros #run

macro encryption-macros-encryption

This crate belongs to the encryption-macros crate

1 unstable release

0.1.2 Apr 19, 2022
0.1.1 Apr 8, 2022
0.1.0 Apr 8, 2022

#36 in #xor


Used in encryption-macros

MIT/Apache

10KB
139 lines

encryption-marcos

This crate provides macros to XOR strings declarative or automatically at compile time and automatically decode them at run time.

The XOR key is automatically generated via a macro expansion in the utils sub-crate. To generate a new key just run cargo clean and recompiled the target to re-expand this macro.

Example

use encryption_macros::encrypt_strings;

encrypt_strings!{
    fn main() {
        println!("everything in this scope gets encrypted, {}", "even this")
    }
}

Warning

format_args! cannot capture variables when the format string is expanded from a macro.

So something like this: println!("{variable_a}") sadly doesn't work when inside an encrypted scope.

Dependencies

~590KB
~10K SLoC