Bitcoin Core 28.99.0
P2P Digital Currency
|
Forward-secure ChaCha20. More...
#include <chacha20.h>
Public Member Functions | |
FSChaCha20 (const FSChaCha20 &)=delete | |
FSChaCha20 (FSChaCha20 &&)=delete | |
FSChaCha20 & | operator= (const FSChaCha20 &)=delete |
FSChaCha20 & | operator= (FSChaCha20 &&)=delete |
FSChaCha20 (Span< const std::byte > key, uint32_t rekey_interval) noexcept | |
Construct an FSChaCha20 cipher that rekeys every rekey_interval Crypt() calls. More... | |
void | Crypt (Span< const std::byte > input, Span< std::byte > output) noexcept |
Encrypt or decrypt a chunk. More... | |
Static Public Attributes | |
static constexpr unsigned | KEYLEN = 32 |
Length of keys expected by the constructor. More... | |
Private Attributes | |
ChaCha20 | m_chacha20 |
Internal stream cipher. More... | |
const uint32_t | m_rekey_interval |
The number of encryptions/decryptions before a rekey happens. More... | |
uint32_t | m_chunk_counter {0} |
The number of encryptions/decryptions since the last rekey. More... | |
uint64_t | m_rekey_counter {0} |
The number of rekey operations that have happened. More... | |
Forward-secure ChaCha20.
This implements a stream cipher that automatically transitions to a new stream with a new key and new nonce after a predefined number of encryptions or decryptions.
See BIP324 for details.
Definition at line 127 of file chacha20.h.
|
delete |
|
delete |
|
noexcept |
Construct an FSChaCha20 cipher that rekeys every rekey_interval Crypt() calls.
Definition at line 344 of file chacha20.cpp.
Encrypt or decrypt a chunk.
Definition at line 350 of file chacha20.cpp.
|
delete |
|
delete |
|
staticconstexpr |
Length of keys expected by the constructor.
Definition at line 144 of file chacha20.h.
|
private |
Internal stream cipher.
Definition at line 131 of file chacha20.h.
|
private |
The number of encryptions/decryptions since the last rekey.
Definition at line 137 of file chacha20.h.
|
private |
The number of rekey operations that have happened.
Definition at line 140 of file chacha20.h.
|
private |
The number of encryptions/decryptions before a rekey happens.
Definition at line 134 of file chacha20.h.