#encryption #obfuscation #compile-time #string-literal #litcrypt

macro litcrypt2

Let's encrypt your string statically during compile time

4 releases

Uses old Rust 2015

0.1.3 Sep 23, 2024
0.1.2 Jan 3, 2024
0.1.1 Nov 19, 2023
0.1.0 Nov 14, 2023

#2115 in Procedural macros

Download history 53/week @ 2024-07-18 43/week @ 2024-07-25 104/week @ 2024-08-01 73/week @ 2024-08-08 66/week @ 2024-08-15 70/week @ 2024-08-22 46/week @ 2024-08-29 49/week @ 2024-09-05 57/week @ 2024-09-12 225/week @ 2024-09-19 113/week @ 2024-09-26 105/week @ 2024-10-03 99/week @ 2024-10-10 106/week @ 2024-10-17 35/week @ 2024-10-24 32/week @ 2024-10-31

303 downloads per month
Used in 11 crates (9 directly)

Apache-2.0

17KB
251 lines

LITCRYPT2

It's a short name of "Literal Encryption", a Rust proc macro that encrypts text using a basic XOR method. It protect plain text from static analysis tools and helps keep your important app safe from cracking activity.

LITCRYPT2 encrypts strings when compiling, keeping them encrypted in both disk and memory while running, and only decrypting them when needed.

This crate is just a maintained and updated fork of the original crate, LITCRYPT by Robin Syihab (r@ansvia.com).

USAGE

Dependencies:

[dependencies]
litcrypt2 = "0.1.3"

Example:

#[macro_use]
extern crate litcrypt2;

use_litcrypt!();

fn main()
{
    println!("his name is: {}", lc!("Voldemort"));
}

fn raw_string()
{
    println!("The command line console can be found in the path {}", lc!(r"C:\Windows\System32\cmd.exe"));
}

use_litcrypt! macro call should be called first for initialization before you can use lc! macro function.

Please take note that you can set your encryption key to a specific value using the environment variable LITCRYPT_ENCRYPT_KEY before compile. In case that you don't set this environment variable, the crate will generate a random encryption key at compilation time: e.g:

$ export LITCRYPT_ENCRYPT_KEY="myverysuperdupermegaultrasecretkey"

Litcrypt will encrypt each string written inside lc! statically.

Check the output binary using strings command to verify:

$ strings target/debug/my_valuable_app | grep Voldemort

If the output is blank then your valuable string in your app is safe from static analyzer tool like Hexeditor etc.

For working example code see ./examples directory, and test using:

$ cargo run --example simple

Dependencies

~260–395KB