Secured-Cipher Library
secured-cipher is a Rust library offering an implementation of the ChaCha20 and XChaCha20 encryption algorithms.
It provides both high-level and low-level cryptographic functionalities through a common interface.
Overview
The library includes the following key components:
core: A module containing essential ChaCha20 cryptographic functionalities.ChaCha20: A struct for the ChaCha20 stream cipher algorithm.Cipher: A struct that provides a common interface for cryptographic operations, focusing on encryption and decryption.CipherMode: An enum to specify the mode of the cipher (only ChaCha20 for now).
Features
- High-level interfaces for ChaCha20 and XChaCha20 ciphers.
- Common
Cipherinterface for encryption and decryption operations. - Flexible usage with support for both raw and high-level cryptographic operations.
Usage
Basic Encryption and Decryption
This example demonstrates encrypting and decrypting 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;
let encrypted_data = cipher.encrypt;
println!;
let decrypted_data = cipher.decrypt;
println!;
Modules
core: Core functionalities and algorithmic implementations.stream: Internal stream cipher operations, includingChaChaStream.