ddn.crypto.cipher.chacha

ChaCha20 Stream Cipher (RFC 7539).

class ChaCha20

Types 1

ChaCha20 Implementation.

Supports 32-byte keys. Supports 12-byte nonce (RFC 7539) and 8-byte nonce (Legacy).

Fields
private uint[16] _state
private uint[16] _initialState
private ubyte[64] _keystream
private size_t _keystreamIdx
private bool _initialized
private bool _isRFC7539
private uint[4] SIGMA
Methods
void init(CipherOperation op, Key key, const(ubyte)[] iv = null)
ubyte[] update(const(ubyte)[] input)
ubyte[] finish(const(ubyte)[] input = null)
void setCounter(ulong counter)Manually sets the counter. Useful for random access or specific protocols. Params: counter = The counter value.
private void generateBlock()
private void quarterRound(int a, int b, int c, int d)
private uint rotateLeft(uint x, int n) pure nothrow @nogc
private uint readU32(const(ubyte)[] data, size_t offset)