|
libkeepass 0.2.0
KeePass key database importer/exporter library
|
ChaCha20 stream cipher implementation (RFC 8439, 32-bit counter). More...
#include <cipher.hh>
Public Member Functions | |
| ChaCha20Cipher (const uint8_t *key, const std::array< uint8_t, 12 > &init_vec) | |
| Constructs a ChaCha20 cipher with the given key and nonce. | |
| ~ChaCha20Cipher () | |
| Zeroizes the cipher state holding the key. | |
| void | Process (const std::array< uint8_t, 64 > &src, std::array< uint8_t, 64 > &dst) |
| Encrypts or decrypts a single 64-byte block. | |
ChaCha20 stream cipher implementation (RFC 8439, 32-bit counter).
| keepass::ChaCha20Cipher::ChaCha20Cipher | ( | const uint8_t * | key, |
| const std::array< uint8_t, 12 > & | init_vec | ||
| ) |
Constructs a ChaCha20 cipher with the given key and nonce.
| key | The 256-bit (32-byte) encryption key. |
| init_vec | The 12-byte nonce (initialization vector). |
| void keepass::ChaCha20Cipher::Process | ( | const std::array< uint8_t, 64 > & | src, |
| std::array< uint8_t, 64 > & | dst | ||
| ) |
Encrypts or decrypts a single 64-byte block.
Because ChaCha20 is a stream cipher, encryption and decryption are the same XOR operation. The internal counter is advanced after each call.
| src | The 64-byte input block (plaintext or ciphertext). |
| dst | The 64-byte output block (ciphertext or plaintext). |