Bitcoin Core
21.99.0
P2P Digital Currency
src
crypto
chacha20.h
Go to the documentation of this file.
1
// Copyright (c) 2017-2019 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_CRYPTO_CHACHA20_H
6
#define BITCOIN_CRYPTO_CHACHA20_H
7
8
#include <stdint.h>
9
#include <stdlib.h>
10
13
class
ChaCha20
14
{
15
private
:
16
uint32_t
input
[16];
17
18
public
:
19
ChaCha20
();
20
ChaCha20
(
const
unsigned
char
* key,
size_t
keylen);
21
void
SetKey
(
const
unsigned
char
* key,
size_t
keylen);
22
void
SetIV
(uint64_t iv);
// set the 64bit nonce
23
void
Seek
(uint64_t pos);
// set the 64bit block counter
24
26
void
Keystream
(
unsigned
char
* c,
size_t
bytes);
27
31
void
Crypt
(
const
unsigned
char
*
input
,
unsigned
char
* output,
size_t
bytes);
32
};
33
34
#endif // BITCOIN_CRYPTO_CHACHA20_H
ChaCha20::SetKey
void SetKey(const unsigned char *key, size_t keylen)
set key with flexible keylength; 256bit recommended */
Definition:
chacha20.cpp:24
ChaCha20::Keystream
void Keystream(unsigned char *c, size_t bytes)
outputs the keystream of size <bytes> into
Definition:
chacha20.cpp:74
ChaCha20::Crypt
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>...
Definition:
chacha20.cpp:182
ChaCha20::Seek
void Seek(uint64_t pos)
Definition:
chacha20.cpp:68
ChaCha20::input
uint32_t input[16]
Definition:
chacha20.h:16
ChaCha20::ChaCha20
ChaCha20()
Definition:
chacha20.cpp:52
ChaCha20::SetIV
void SetIV(uint64_t iv)
Definition:
chacha20.cpp:62
ChaCha20
A class for ChaCha20 256-bit stream cipher developed by Daniel J.
Definition:
chacha20.h:13
Generated on Fri Apr 9 2021 20:04:19 for Bitcoin Core by
1.8.17