libslug 0.9.1

A Rust Library For Cryptography Intended For Slug20 That Supports X59 Certificate Format and Post-Quantum Cryptography
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use libslug::slugcrypt::api::{SlugCrypt,SlugDigest};

use libslug::slugcrypt::internals::encrypt::chacha20::{EncryptionKey,EncryptionNonce,EncryptionCipherText};
use libslug::slugcrypt::internals::encrypt::aes256;
use libslug::slugcrypt::api::SlugAsyCrypt;


fn main() {
    let key = EncryptionKey::generate();
    let key_hex = key.to_hex().unwrap();
    let data = "encrypted by xchacha20-poly1305";

    let crypt = SlugCrypt::encrypt(key, data).unwrap();

    let decrypted = SlugCrypt::decrypt(EncryptionKey::from_hex(&key_hex).unwrap(), crypt.1, crypt.0).unwrap();
    println!("Decrypted: {}", String::from_utf8(decrypted).unwrap());
}