Zeth - Zerocash on Ethereum
0.8
Reference implementation of the Zeth protocol by Clearmatics
libzeth
core
chacha_rng.hpp
Go to the documentation of this file.
1
// Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2
//
3
// SPDX-License-Identifier: LGPL-3.0+
4
5
#ifndef __ZETH_CORE_CHACHA_RNG_HPP__
6
#define __ZETH_CORE_CHACHA_RNG_HPP__
7
8
#include <cstddef>
9
#include <cstdint>
10
11
namespace
libzeth
12
{
13
22
class
chacha_rng
23
{
24
public
:
25
chacha_rng
(
const
void
*seed,
size_t
seed_size);
26
void
random
(
void
*output,
size_t
output_size);
27
28
private
:
29
void
update();
30
31
// The key generated from the seed data
32
uint32_t key[8];
33
34
// 128-bit counter
35
uint32_t counter[4];
36
37
// Current block of output from chacha
38
uint8_t block[64];
39
40
// Number of bytes of data already used from block
41
size_t
data_used;
42
};
43
44
}
// namespace libzeth
45
46
#endif // __ZETH_CORE_CHACHA_RNG_HPP__
libzeth::chacha_rng::chacha_rng
chacha_rng(const void *seed, size_t seed_size)
Definition:
chacha_rng.cpp:20
libzeth
Definition:
binary_operation.hpp:15
libzeth::chacha_rng::random
void random(void *output, size_t output_size)
Definition:
chacha_rng.cpp:35
libzeth::chacha_rng
Definition:
chacha_rng.hpp:22
Generated on Mon Nov 28 2022 10:29:03 for Zeth - Zerocash on Ethereum by
1.8.17