sc

Macro sc 

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

Encrypts the contained literal string using Aes256Gcm with the key embedded using use_staticrypt and a randomly generated nonce (derived from the STATICRYPT_SEED env variable at compile time).

Example:

use staticrypt::*;

use_staticrypt!();

fn main() {
    // "My secret text" will be encrypted in the resulting binary
    let encrypted = sc!("My secret text");
     
    assert_eq!(encrypted, "My secret text");
     
    // Also works with unicode / non-standard characters, and escape sequences:
    let encrypted = sc!("My\0 nonstandard \u{0256} Text \"with escapes\"");
     
    assert_eq!(encrypted, "My\0 nonstandard \u{0256} Text \"with escapes\"");
}