Secured-Cipher Library
This library, secured-cipher, provides an implementation of the ChaCha20 encryption algorithm,
along with a common cryptographic interface defined by the Cipher trait.
The library is structured to offer both low-level and high-level cryptographic functionalities.
Overview
ChaCha20: A struct that provides a high-level interface for the ChaCha20 stream cipher algorithm. It offers methods for encryption and decryption operations, simplifying the use of the underlyingChaChaStream.ChaChaStream: A struct that handles the core state and operations of the ChaCha20 cipher. It is used internally byChaCha20but can also be used directly for lower-level control.Cipher: A trait that defines a standard interface for cryptographic operations, specifically focusing on encryption and decryption methods.- Type aliases (
Slice,Key,Nonce,Bytes): These simplify the usage of common cryptographic data types such as keys, nonces, and byte slices.
Usage
Encrypting Data with ChaCha20
use ;
let key: = ; // Replace with your key
let nonce: = ; // Replace with your nonce
let data: & = b"Your data here"; // Data to be encrypted
let mut cipher = new;
let encrypted_data = cipher.encrypt;
println!;
Decrypting Data with ChaCha20
use ;
let key: = ; // Replace with your key
let nonce: = ; // Replace with your nonce
let encrypted_data: & = &; // Replace with your encrypted data
let mut cipher = new;
let decrypted_data = cipher.decrypt;
println!;
Modules
core: Contains core functionalities and algorithmic implementations.stream: Provides theChaChaStreamstruct and related functions for internal stream cipher operations.
This library aims to provide an easy-to-use and efficient implementation of the ChaCha20 cipher,
suitable for various cryptographic needs. Whether you need high-level interfaces with ChaCha20
or low-level control with ChaChaStream, secured-cipher is equipped to meet your cryptographic requirements.