Bitcoin Core  0.18.99
P2P Digital Currency
Functions | Variables
chacha_poly_aead.cpp File Reference
#include <iostream>
#include <bench/bench.h>
#include <crypto/chacha_poly_aead.h>
#include <crypto/poly1305.h>
#include <hash.h>
#include <limits>
#include <assert.h>
Include dependency graph for chacha_poly_aead.cpp:

Go to the source code of this file.

Functions

static void CHACHA20_POLY1305_AEAD (benchmark::State &state, size_t buffersize, bool include_decryption)
 
static void CHACHA20_POLY1305_AEAD_64BYTES_ONLY_ENCRYPT (benchmark::State &state)
 
static void CHACHA20_POLY1305_AEAD_256BYTES_ONLY_ENCRYPT (benchmark::State &state)
 
static void CHACHA20_POLY1305_AEAD_1MB_ONLY_ENCRYPT (benchmark::State &state)
 
static void CHACHA20_POLY1305_AEAD_64BYTES_ENCRYPT_DECRYPT (benchmark::State &state)
 
static void CHACHA20_POLY1305_AEAD_256BYTES_ENCRYPT_DECRYPT (benchmark::State &state)
 
static void CHACHA20_POLY1305_AEAD_1MB_ENCRYPT_DECRYPT (benchmark::State &state)
 
static void HASH (benchmark::State &state, size_t buffersize)
 
static void HASH_64BYTES (benchmark::State &state)
 
static void HASH_256BYTES (benchmark::State &state)
 
static void HASH_1MB (benchmark::State &state)
 
 BENCHMARK (CHACHA20_POLY1305_AEAD_64BYTES_ONLY_ENCRYPT, 500000)
 
 BENCHMARK (CHACHA20_POLY1305_AEAD_256BYTES_ONLY_ENCRYPT, 250000)
 
 BENCHMARK (CHACHA20_POLY1305_AEAD_1MB_ONLY_ENCRYPT, 340)
 
 BENCHMARK (CHACHA20_POLY1305_AEAD_64BYTES_ENCRYPT_DECRYPT, 500000)
 
 BENCHMARK (CHACHA20_POLY1305_AEAD_256BYTES_ENCRYPT_DECRYPT, 250000)
 
 BENCHMARK (CHACHA20_POLY1305_AEAD_1MB_ENCRYPT_DECRYPT, 340)
 
 BENCHMARK (HASH_64BYTES, 500000)
 
 BENCHMARK (HASH_256BYTES, 250000)
 
 BENCHMARK (HASH_1MB, 340)
 

Variables

static constexpr uint64_t BUFFER_SIZE_TINY = 64
 
static constexpr uint64_t BUFFER_SIZE_SMALL = 256
 
static constexpr uint64_t BUFFER_SIZE_LARGE = 1024 * 1024
 
static const unsigned char k1 [32] = {0}
 
static const unsigned char k2 [32] = {0}
 
static ChaCha20Poly1305AEAD aead (k1, 32, k2, 32)
 

Function Documentation

◆ BENCHMARK() [1/9]

BENCHMARK ( CHACHA20_POLY1305_AEAD_64BYTES_ONLY_ENCRYPT  ,
500000   
)
Here is the caller graph for this function:

◆ BENCHMARK() [2/9]

BENCHMARK ( CHACHA20_POLY1305_AEAD_256BYTES_ONLY_ENCRYPT  ,
250000   
)

◆ BENCHMARK() [3/9]

BENCHMARK ( CHACHA20_POLY1305_AEAD_1MB_ONLY_ENCRYPT  ,
340   
)

◆ BENCHMARK() [4/9]

BENCHMARK ( CHACHA20_POLY1305_AEAD_64BYTES_ENCRYPT_DECRYPT  ,
500000   
)

◆ BENCHMARK() [5/9]

BENCHMARK ( CHACHA20_POLY1305_AEAD_256BYTES_ENCRYPT_DECRYPT  ,
250000   
)

◆ BENCHMARK() [6/9]

BENCHMARK ( CHACHA20_POLY1305_AEAD_1MB_ENCRYPT_DECRYPT  ,
340   
)

◆ BENCHMARK() [7/9]

BENCHMARK ( HASH_64BYTES  ,
500000   
)

◆ BENCHMARK() [8/9]

BENCHMARK ( HASH_256BYTES  ,
250000   
)

◆ BENCHMARK() [9/9]

BENCHMARK ( HASH_1MB  ,
340   
)

◆ CHACHA20_POLY1305_AEAD()

static void CHACHA20_POLY1305_AEAD ( benchmark::State state,
size_t  buffersize,
bool  include_decryption 
)
static

Definition at line 25 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CHACHA20_POLY1305_AEAD_1MB_ENCRYPT_DECRYPT()

static void CHACHA20_POLY1305_AEAD_1MB_ENCRYPT_DECRYPT ( benchmark::State state)
static

Definition at line 85 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CHACHA20_POLY1305_AEAD_1MB_ONLY_ENCRYPT()

static void CHACHA20_POLY1305_AEAD_1MB_ONLY_ENCRYPT ( benchmark::State state)
static

Definition at line 70 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CHACHA20_POLY1305_AEAD_256BYTES_ENCRYPT_DECRYPT()

static void CHACHA20_POLY1305_AEAD_256BYTES_ENCRYPT_DECRYPT ( benchmark::State state)
static

Definition at line 80 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CHACHA20_POLY1305_AEAD_256BYTES_ONLY_ENCRYPT()

static void CHACHA20_POLY1305_AEAD_256BYTES_ONLY_ENCRYPT ( benchmark::State state)
static

Definition at line 65 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CHACHA20_POLY1305_AEAD_64BYTES_ENCRYPT_DECRYPT()

static void CHACHA20_POLY1305_AEAD_64BYTES_ENCRYPT_DECRYPT ( benchmark::State state)
static

Definition at line 75 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CHACHA20_POLY1305_AEAD_64BYTES_ONLY_ENCRYPT()

static void CHACHA20_POLY1305_AEAD_64BYTES_ONLY_ENCRYPT ( benchmark::State state)
static

Definition at line 60 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HASH()

static void HASH ( benchmark::State state,
size_t  buffersize 
)
static

Definition at line 92 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HASH_1MB()

static void HASH_1MB ( benchmark::State state)
static

Definition at line 110 of file chacha_poly_aead.cpp.

Here is the call graph for this function:

◆ HASH_256BYTES()

static void HASH_256BYTES ( benchmark::State state)
static

Definition at line 105 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HASH_64BYTES()

static void HASH_64BYTES ( benchmark::State state)
static

Definition at line 100 of file chacha_poly_aead.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ aead

ChaCha20Poly1305AEAD aead(k1, 32, k2, 32)
static

◆ BUFFER_SIZE_LARGE

constexpr uint64_t BUFFER_SIZE_LARGE = 1024 * 1024
static

Definition at line 18 of file chacha_poly_aead.cpp.

◆ BUFFER_SIZE_SMALL

constexpr uint64_t BUFFER_SIZE_SMALL = 256
static

Definition at line 17 of file chacha_poly_aead.cpp.

◆ BUFFER_SIZE_TINY

constexpr uint64_t BUFFER_SIZE_TINY = 64
static

Definition at line 16 of file chacha_poly_aead.cpp.

◆ k1

const unsigned char k1[32] = {0}
static

Definition at line 20 of file chacha_poly_aead.cpp.

◆ k2

const unsigned char k2[32] = {0}
static

Definition at line 21 of file chacha_poly_aead.cpp.