Secured-Cipher Library
Overview
secured-cipher is a Rust library offering an implementation of the ChaCha20 and Poly1305 algorithms. It provides both high-level and low-level cryptographic functionalities through a common interface.
Features
- High-level interfaces for
ChaCha20cipher andPoly1305authenticator. - Common
Cipherinterface for encryption and decryption operations. coremodule with low-level crypto operations- Flexible usage with support for both raw and high-level cryptographic operations.
Basic Encryption and Decryption Example
Encrypt and decrypt data using the ChaCha20 cipher:
use Cipher;
let key: = ; // Your key
let nonce: = ; // Your nonce
let data: & = b"Your data here"; // Data to be encrypted
let mut cipher = default;
cipher.init;
// Encrypt and decrypt
let encrypted_data = cipher.encrypt;
let decrypted_data = cipher.decrypt;
// Sign
let signed_secret_envelope = cipher.sign;
// Decrypt and verify
let verified_decrypted_data = cipher.decrypt_and_verify;
assert!;
println!;
Installation
Add secured-cipher to your Cargo.toml:
[]
= "~0.3.1"