Crates.io | nutek-cipher-lib |
lib.rs | nutek-cipher-lib |
version | 0.1.0 |
source | src |
created_at | 2023-09-21 14:49:57.838717 |
updated_at | 2023-09-21 14:49:57.838717 |
description | Encrypt and decrypt data using AES-GCM-SIV. |
homepage | |
repository | https://github.com/nutek-terminal/nutek-cipher-lib |
max_upload_size | |
id | 979582 |
size | 6,119 |
a library for encrypting and decrypting text using the AES-GCM-SIV cipher
cargo add nutek-cipher-lib
use nutek_cipher_lib::aes_gcm_siv::encrypt;
use nutek_cipher_lib::aes_gcm_siv::decrypt;
fn main() {
let key = b"0123456789abcdef0123456789abcdef";
let nonce = b"123456123456";
let plaintext = b"Hello, world!";
let ciphertext = encrypt(plaintext, nonce, key);
let decrypted = decrypt(key, nonce, &ciphertext).unwrap();
assert_eq!(plaintext, decrypted);
}
non-commercial use only, see LICENSE