23 #ifndef CRYPTO_CHACHA_h 
   24 #define CRYPTO_CHACHA_h 
   42     bool setKey(
const uint8_t *key, 
size_t len);
 
   43     bool setIV(
const uint8_t *iv, 
size_t len);
 
   44     bool setCounter(
const uint8_t *counter, 
size_t len);
 
   46     void encrypt(uint8_t *output, 
const uint8_t *input, 
size_t len);
 
   47     void decrypt(uint8_t *output, 
const uint8_t *input, 
size_t len);
 
   51     static void hashCore(uint32_t *output, 
const uint32_t *input, uint8_t rounds);
 
   59     void keystreamBlock(uint32_t *output);
 
Authenticated cipher based on ChaCha and Poly1305.
void setNumRounds(uint8_t numRounds)
Sets the number of encryption rounds.
void decrypt(uint8_t *output, const uint8_t *input, size_t len)
Decrypts an input buffer and writes the plaintext to an output buffer.
static void hashCore(uint32_t *output, const uint32_t *input, uint8_t rounds)
Executes the ChaCha hash core on an input memory block.
uint8_t numRounds() const
Returns the number of encryption rounds; usually 8, 12, or 20.
ChaCha(uint8_t numRounds=20)
Constructs a new ChaCha stream cipher.
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
bool setIV(const uint8_t *iv, size_t len)
Sets the initialization vector to use for future encryption and decryption operations.
size_t keySize() const
Default size of the key for this cipher, in bytes.
size_t ivSize() const
Size of the initialization vector for this cipher, in bytes.
bool setCounter(const uint8_t *counter, size_t len)
Sets the starting counter for encryption.
void encrypt(uint8_t *output, const uint8_t *input, size_t len)
Encrypts an input buffer and writes the ciphertext to an output buffer.
void clear()
Clears all security-sensitive state from this cipher.
Abstract base class for stream ciphers.