Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rustaceanrob/chacha20poly1305
extension of the ChaCha20 stream cipher to include authenticated data
https://github.com/rustaceanrob/chacha20poly1305
Last synced: 13 days ago
JSON representation
extension of the ChaCha20 stream cipher to include authenticated data
- Host: GitHub
- URL: https://github.com/rustaceanrob/chacha20poly1305
- Owner: rustaceanrob
- License: mit
- Created: 2024-03-06T04:19:48.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-03-13T20:35:29.000Z (10 months ago)
- Last Synced: 2024-10-31T14:07:07.625Z (2 months ago)
- Language: Rust
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## ChaCha20Poly1305
The extension of the ChaCha20 stream cipher to encrypt and decrypt messages with additional data.
#### Features
- [x] Stack allocated
- [x] In-place decryption
- [x] Optional additional data#### License
MIT
#### Usage
```rust
let key = hex::decode("85d6be7857556d337f4452fe42d506a80103808afb0db2fd4abff6af4149f51b").unwrap();
let key = key.as_slice();
let nonce = [0u8; 12];
let mut message = *b"Cryptographic Forum Research Group";
let cipher = ChaCha20Poly1305::new(key.try_into().unwrap(), nonce);
let mut buffer = [0u8; 50];
cipher.encrypt(message.as_mut_slice(), None, buffer.as_mut_slice());
```