Bitcoin
Public Member Functions | Private Attributes | List of all members
ChaCha20 Class Reference

#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)
 
void Crypt (const unsigned char *input, unsigned char *output, size_t bytes)
 

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

Constructor & Destructor Documentation

◆ ChaCha20() [1/2]

ChaCha20::ChaCha20 ( )

◆ ChaCha20() [2/2]

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

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)

◆ Keystream()

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

outputs the keystream of size <bytes> into

◆ Seek()

void ChaCha20::Seek ( uint64_t  pos)

◆ SetIV()

void ChaCha20::SetIV ( uint64_t  iv)

◆ SetKey()

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

set key with flexible keylength; 256bit recommended */

Member Data Documentation

◆ input

uint32_t ChaCha20::input[16]
private

The documentation for this class was generated from the following files: