78 void setKey(
const Key& key);
80 void setIv(
const Iv& iv);
98 static const byte _sigma[];
void encrypt(ByteBufConst msg, ByteBuf cipher)
Encrypt a message. Result is stored in cipher.
Definition: Chacha.cpp:152
A contiguous region of referenced (not owned by object) memory.
Definition: Buffer.h:17
void setState(const State &state)
Set the state of the generator.
Definition: Chacha.h:88
Random number generator interface.
Definition: Gen.h:11
uint8 byte
An unsigned 8-bit integer.
Definition: Bytes.h:12
uint32 resIdx
Definition: Chacha.h:62
unsigned int uint32
Definition: Core.h:16
void setKey(const Key &key)
Init generator with a cryptographic key.
Definition: Chacha.cpp:124
static const szt coreSize
Definition: Chacha.h:54
unsigned long long uint64
Definition: Core.h:22
State & getState()
Get the current state of the generator. Pass result into setState() to restore a state.
Definition: Chacha.h:90
State()
Definition: Chacha.h:56
void setSeed()
Set the seed using a default method that gathers entropy from the device.
Definition: Chacha.cpp:24
uint32 core[coreSize]
512-bit state
Definition: Chacha.h:59
~Chacha()
Definition: Chacha.h:66
ChaCha8, a cryptographically secure pseudo random number generator.
Definition: Chacha.h:41
ByteArray< 32 > Key
256-bit Cryptographic Key
Definition: Chacha.h:45
ByteArray< 8 > Iv
64-bit Cryptographic IV
Definition: Chacha.h:47
size_t szt
Size type, shorthand for size_t.
Definition: Core.h:90
void setIv(const Iv &iv)
Set initialization vector into generator. Call for every message between encrypt/decrypt calls to pro...
Definition: Chacha.cpp:142
Chacha()
Definition: Chacha.h:65
ByteArray< 40 > Seed
320-bit Seed (Key+IV)
Definition: Chacha.h:49
Generator State.
Definition: Chacha.h:52
virtual uint64 next()
Generate random number between 0 and 2^64-1 inclusive.
Definition: Chacha.cpp:113
Global Honeycomb namespace.
void decrypt(ByteBufConst cipher, ByteBuf msg)
Decrypt a cipher. Result is stored in msg.
Definition: Chacha.cpp:295
uint32 res[coreSize]
Cached results from step()
Definition: Chacha.h:61