ChaCha.start

Initialize the ChaCha20 stream cipher.

struct ChaCha(uint rounds)
@safe nothrow @nogc
void
start
(
,
in ubyte[] key
,
in ubyte[] iv
,
in uint initial_counter = 1
)
in { assert (key.length == 32, "ChaCha requires a 32 byte key."); assert (iv.length == 12, "ChaCha requires a 12 byte nonce."); }
if (
rounds % 2 == 0
)

Parameters

forEncryption
Type: bool

Not used, because encryption and decryptioin are the same.

key
Type: ubyte[]

A secret key of 32 bytes length (256 bit).

iv
Type: ubyte[]

A nonce of 12 bytes length (96 bit).

initial_counter
Type: uint

The initial value of the counter. The default is 1. (Set this to 2 to skip the first block.)

Meta