You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
674 B
27 lines
674 B
8 years ago
|
// 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
|