Bitcoin Core 28.99.0
P2P Digital Currency
|
Unrestricted ChaCha20 cipher. More...
#include <chacha20.h>
Public Types | |
using | Nonce96 = ChaCha20Aligned::Nonce96 |
96-bit nonce type. More... | |
Public Member Functions | |
ChaCha20 () noexcept=delete | |
For safety, disallow initialization without key. More... | |
ChaCha20 (Span< const std::byte > key) noexcept | |
Initialize a cipher with specified 32-byte key. More... | |
~ChaCha20 () | |
Destructor to clean up private memory. More... | |
void | SetKey (Span< const std::byte > key) noexcept |
Set 32-byte key, and seek to nonce 0 and block position 0. More... | |
void | Seek (Nonce96 nonce, uint32_t block_counter) noexcept |
Set the 96-bit nonce and 32-bit block counter. More... | |
void | Crypt (Span< const std::byte > in_bytes, Span< std::byte > out_bytes) noexcept |
en/deciphers the message <in_bytes> and write the result into <out_bytes> More... | |
void | Keystream (Span< std::byte > out) noexcept |
outputs the keystream to out. More... | |
Static Public Attributes | |
static constexpr unsigned | KEYLEN = ChaCha20Aligned::KEYLEN |
Expected key length in constructor and SetKey. More... | |
Private Attributes | |
ChaCha20Aligned | m_aligned |
std::array< std::byte, ChaCha20Aligned::BLOCKLEN > | m_buffer |
unsigned | m_bufleft {0} |
Unrestricted ChaCha20 cipher.
Definition at line 77 of file chacha20.h.
96-bit nonce type.
Definition at line 101 of file chacha20.h.
|
deletenoexcept |
For safety, disallow initialization without key.
|
inlinenoexcept |
Initialize a cipher with specified 32-byte key.
Definition at line 92 of file chacha20.h.
ChaCha20::~ChaCha20 | ( | ) |
Destructor to clean up private memory.
Definition at line 332 of file chacha20.cpp.
en/deciphers the message <in_bytes> and write the result into <out_bytes>
The size of in_bytes and out_bytes must be equal.
Definition at line 303 of file chacha20.cpp.
|
noexcept |
outputs the keystream to out.
Definition at line 282 of file chacha20.cpp.
|
inlinenoexcept |
Set the 96-bit nonce and 32-bit block counter.
Definition at line 104 of file chacha20.h.
|
noexcept |
Set 32-byte key, and seek to nonce 0 and block position 0.
Definition at line 337 of file chacha20.cpp.
|
staticconstexpr |
Expected key length in constructor and SetKey.
Definition at line 86 of file chacha20.h.
|
private |
Definition at line 80 of file chacha20.h.
|
private |
Definition at line 81 of file chacha20.h.
|
private |
Definition at line 82 of file chacha20.h.