#encryption #aes #automotive #hsm #hash

neo-crypto

An encryption algorithm library written in Rust

3 releases

0.1.2 Feb 10, 2024
0.1.1 Feb 10, 2024
0.1.0 Feb 10, 2024

#755 in Cryptography

Download history 1/week @ 2024-02-07 41/week @ 2024-02-14 42/week @ 2024-02-21 30/week @ 2024-02-28 1/week @ 2024-03-06 7/week @ 2024-03-13 17/week @ 2024-03-27 31/week @ 2024-04-03

55 downloads per month

MIT/Apache

53KB
1.5K SLoC

neo-crypto

This algorithm lib supplies you a set of simple interface to achieve your encryption requirements

Usage

Add this to your Cargo.toml

[dependencies]
neo-crypto = "<version>"

Supported Features

  • SHA Family

  • AES Family

  • CMAC

  • AES-MP

  • Base64

  • Memory Update Protocol

  • Padding

  • RSA(Developing)

Examples

SHA

use neo_crypto::sha::{sha, ShaType};
fn main() {
    let msg: String = String::from("It is neo-crypto");
    let hash_text: Vec<u8> = sha(&msg, ShaType::SHA256);
    println!("{:?}", hash_text); //[110, 61, 35, 228, 69, 228, 253, 91, 91, 79, 229, 196, 34, 253, 109, 35, 46, 241, 255, 188, 82, 162, 166, 25, 181, 96, 140, 196, 94, 203, 100, 177]
}

Note:

Add the this to Cargo.toml to avoid overflow warning

[profile.dev]
overflow-checks = false

AES

use neo_crypto::aes::{aes_ecb_enc, AesType};
fn main() {
    let msg: String = String::from("It is neo-crypto");
    let aes_key: String = String::from("0123456789ABCDEF");
    let enc_text: Vec<u8> = aes_ecb_enc(&msg.into_bytes(), &aes_key.into_bytes(), &AesType::AES128);
    println!("{:?}", enc_text); //[20, 223, 131, 141, 80, 131, 81, 224, 163, 90, 211, 211, 249, 186, 21, 60]
}

Dependencies

~1–1.4MB
~25K SLoC