cryptolib
This algorithm lib supplies you a set of simple interface to achieve your encryption requirements
Usage
Add this to your Cargo.toml
[dependencies]
cryptolib = "<version>"
Supported Features
-
SHA Family
-
AES Family
-
CMAC
-
AES-MP
-
Base64
-
Memory Update Protocol
-
Padding
-
RSA(planned)
Examples
SHA
use cryptolib::sha::{sha, ShaType};
fn main() {
let msg: String = String::from("It is cryptolib");
let hash_text: Vec<u8> = sha(&msg, ShaType::SHA256);
println!("{:?}", hash_text); }
Note:
Add the this to Cargo.toml
to avoid overflow warning
[profile.dev]
overflow-checks = false
AES
use cryptolib::aes::{aes_ecb_enc, AesType};
fn main() {
let msg: String = String::from("It is cryptolib");
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); }