|
libkeepass 0.2.0
KeePass key database importer/exporter library
|
Salsa20 stream cipher implementation. More...
#include <cipher.hh>
Public Member Functions | |
| Salsa20Cipher (const uint8_t *key) | |
| Constructs a Salsa20 cipher with a zero nonce. | |
| Salsa20Cipher (const uint8_t *key, const std::array< uint8_t, 8 > &init_vec) | |
| Constructs a Salsa20 cipher with a given 64-bit nonce. | |
| ~Salsa20Cipher () | |
| 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. | |
Salsa20 stream cipher implementation.
Constructs a Salsa20 cipher with a zero nonce.
| key | The 256-bit (32-byte) encryption key. |
| keepass::Salsa20Cipher::Salsa20Cipher | ( | const uint8_t * | key, |
| const std::array< uint8_t, 8 > & | init_vec | ||
| ) |
Constructs a Salsa20 cipher with a given 64-bit nonce.
| key | The 256-bit (32-byte) encryption key. |
| init_vec | The 8-byte nonce (initialization vector). |
| void keepass::Salsa20Cipher::Process | ( | const std::array< uint8_t, 64 > & | src, |
| std::array< uint8_t, 64 > & | dst | ||
| ) |
Encrypts or decrypts a single 64-byte block.
Because Salsa20 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). |