diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-02-15 12:29:23 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-03-29 00:40:17 -0700 |
commit | e04326fe6652543dc26d90eba4a48fbdc935fd0c (patch) | |
tree | f918238064983b16c946d21f204a0be3888a54b7 /src/crypto/chacha20.h | |
parent | 663fbae7776b0c238f6f27d73811b4bc627d0b6b (diff) |
Add ChaCha20
Diffstat (limited to 'src/crypto/chacha20.h')
-rw-r--r-- | src/crypto/chacha20.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/crypto/chacha20.h b/src/crypto/chacha20.h new file mode 100644 index 0000000000..a305977bcd --- /dev/null +++ b/src/crypto/chacha20.h @@ -0,0 +1,26 @@ +// Copyright (c) 2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_CRYPTO_CHACHA20_H +#define BITCOIN_CRYPTO_CHACHA20_H + +#include <stdint.h> +#include <stdlib.h> + +/** A PRNG class for ChaCha20. */ +class ChaCha20 +{ +private: + uint32_t input[16]; + +public: + ChaCha20(); + ChaCha20(const unsigned char* key, size_t keylen); + void SetKey(const unsigned char* key, size_t keylen); + void SetIV(uint64_t iv); + void Seek(uint64_t pos); + void Output(unsigned char* output, size_t bytes); +}; + +#endif // BITCOIN_CRYPTO_CHACHA20_H |