36 #define CHACHA_KEY_SIZE 32 37 #define CHACHA_IV_SIZE 8 39 #if defined(__cplusplus) 51 #if defined(__cplusplus) 65 inline void chacha8(
const void*
data, std::size_t length,
const chacha_key&
key,
const chacha_iv&
iv,
char* cipher) {
69 inline void chacha20(
const void*
data, std::size_t length,
const chacha_key&
key,
const chacha_iv&
iv,
char* cipher) {
74 static_assert(
sizeof(chacha_key) <=
sizeof(
hash),
"Size of hash must be at least that of chacha_key");
77 for (
uint64_t n = 1; n < kdf_rounds; ++n)
82 inline void generate_chacha_key_prehashed(
const void *
data,
size_t size, chacha_key&
key,
uint64_t kdf_rounds) {
83 static_assert(
sizeof(chacha_key) <=
sizeof(
hash),
"Size of hash must be at least that of chacha_key");
86 for (
uint64_t n = 1; n < kdf_rounds; ++n)
static const unsigned char iv[64]
Definition: sha512-hash.c:13
::std::string string
Definition: gtest-port.h:1097
void chacha20(const void *data, size_t length, const uint8_t *key, const uint8_t *iv, char *cipher)
Definition: chacha.c:179
std::string data
Definition: base58.cpp:37
const char * key
Definition: hmac_keccak.cpp:40
crypto namespace.
Definition: crypto.cpp:60
unsigned char uint8_t
Definition: stdint.h:124
void chacha8(const void *data, size_t length, const uint8_t *key, const uint8_t *iv, char *cipher)
Definition: chacha.c:174
unsigned __int64 uint64_t
Definition: stdint.h:136
void * memcpy(void *a, const void *b, size_t c)
Definition: glibc_compat.cpp:16
#define CHACHA_IV_SIZE
Definition: chacha.h:37
T & unwrap(mlocked< T > &src)
Definition: mlocker.h:81
static crypto::chacha_key generate_chacha_key()
Definition: ringdb.cpp:47
POD_CLASS hash
Definition: hash.h:49
void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int prehashed, uint64_t height)
#define CHACHA_KEY_SIZE
Definition: chacha.h:36