1 unstable release

0.1.1 Mar 24, 2020

#2328 in Rust patterns

MIT/Apache

10KB
148 lines

Crypto literal library

This crate has POC (Proof Of Concept) status!

Supported algorithms

  • Aes
  • Xor

Usage

First add crypto-literal crate to your Cargo.toml:

[dependencies]
crypto-literal = "0.1"

Now you can write the following code:

#![feature(proc_macro_hygiene)]

use crypto_literal::encrypt;

let crypto_literal = encrypt!("The quick brown fox jumps over the lazy dog.");

or:

#![feature(proc_macro_hygiene)]

use crypto_literal::{encrypt, CryptoLiteral};
use lazy_static::lazy_static;

lazy_static! {
    static ref CRYPTO_LITERAL: CryptoLiteral<str> =
        encrypt!("The quick brown fox jumps over the lazy dog.");
}

lib.rs:

Crypto literal

Examples

Basic usage:

#
#
let crypto_literal = encrypt!("The quick brown fox jumps over the lazy dog");

Static usage:

#
#
lazy_static! {
    static ref CRYPTO_LITERAL: CryptoLiteral<str> =
        encrypt!("The quick brown fox jumps over the lazy dog.");
}

Dependencies

~2.2–3MB
~64K SLoC