Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

A class for ChaCha20 256-bit stream cipher developed by Daniel J. More...

#include <chacha20.h>

Public Member Functions

 ChaCha20 ()
 
 ChaCha20 (const unsigned char *key, size_t keylen)
 
void SetKey (const unsigned char *key, size_t keylen)
 set key with flexible keylength; 256bit recommended */ More...
 
void SetIV (uint64_t iv)
 
void Seek (uint64_t pos)
 
void Keystream (unsigned char *c, size_t bytes)
 outputs the keystream of size <bytes> into More...
 
void Crypt (const unsigned char *input, unsigned char *output, size_t bytes)
 enciphers the message <input> of length <bytes> and write the enciphered representation into <output> Used for encryption and decryption (XOR) More...
 

Private Attributes

uint32_t input [16]
 

Detailed Description

A class for ChaCha20 256-bit stream cipher developed by Daniel J.

Bernstein https://cr.yp.to/chacha/chacha-20080128.pdf

Definition at line 13 of file chacha20.h.

Constructor & Destructor Documentation

◆ ChaCha20() [1/2]

ChaCha20::ChaCha20 ( )

Definition at line 52 of file chacha20.cpp.

References input.

◆ ChaCha20() [2/2]

ChaCha20::ChaCha20 ( const unsigned char *  key,
size_t  keylen 
)

Definition at line 57 of file chacha20.cpp.

References SetKey().

Member Function Documentation

◆ Crypt()

void ChaCha20::Crypt ( const unsigned char *  input,
unsigned char *  output,
size_t  bytes 
)

enciphers the message <input> of length <bytes> and write the enciphered representation into <output> Used for encryption and decryption (XOR)

Definition at line 182 of file chacha20.cpp.

References input, QUARTERROUND, ReadLE32(), and WriteLE32().

Referenced by ChaCha20Poly1305AEAD::Crypt().

◆ Keystream()

void ChaCha20::Keystream ( unsigned char *  c,
size_t  bytes 
)

outputs the keystream of size <bytes> into

Definition at line 74 of file chacha20.cpp.

References input, QUARTERROUND, and WriteLE32().

Referenced by ChaCha20Poly1305AEAD::Crypt(), FastRandomContext::FillByteBuffer(), ChaCha20Poly1305AEAD::GetLength(), and FastRandomContext::randbytes().

◆ Seek()

void ChaCha20::Seek ( uint64_t  pos)

Definition at line 68 of file chacha20.cpp.

References input.

Referenced by ChaCha20Poly1305AEAD::Crypt(), and ChaCha20Poly1305AEAD::GetLength().

◆ SetIV()

void ChaCha20::SetIV ( uint64_t  iv)

Definition at line 62 of file chacha20.cpp.

References input.

Referenced by ChaCha20Poly1305AEAD::Crypt(), and ChaCha20Poly1305AEAD::GetLength().

◆ SetKey()

void ChaCha20::SetKey ( const unsigned char *  key,
size_t  keylen 
)

set key with flexible keylength; 256bit recommended */

Definition at line 24 of file chacha20.cpp.

References input, ReadLE32(), sigma, and tau.

Referenced by ChaCha20(), ChaCha20Poly1305AEAD::ChaCha20Poly1305AEAD(), FastRandomContext::FastRandomContext(), and FastRandomContext::RandomSeed().

Member Data Documentation

◆ input

uint32_t ChaCha20::input[16]
private

Definition at line 16 of file chacha20.h.

Referenced by ChaCha20(), Crypt(), Keystream(), Seek(), SetIV(), and SetKey().


The documentation for this class was generated from the following files:
Released under the MIT license