Bitcoin Core  27.99.0
P2P Digital Currency
Functions | Variables
crypto_tests.cpp File Reference
#include <crypto/aes.h>
#include <crypto/chacha20.h>
#include <crypto/chacha20poly1305.h>
#include <crypto/hkdf_sha256_32.h>
#include <crypto/hmac_sha256.h>
#include <crypto/hmac_sha512.h>
#include <crypto/poly1305.h>
#include <crypto/ripemd160.h>
#include <crypto/sha1.h>
#include <crypto/sha256.h>
#include <crypto/sha3.h>
#include <crypto/sha512.h>
#include <crypto/muhash.h>
#include <random.h>
#include <streams.h>
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <util/strencodings.h>
#include <vector>
#include <boost/test/unit_test.hpp>
Include dependency graph for crypto_tests.cpp:

Go to the source code of this file.

Functions

template<typename Hasher , typename In , typename Out >
static void TestVector (const Hasher &h, const In &in, const Out &out)
 
static void TestSHA1 (const std::string &in, const std::string &hexout)
 
static void TestSHA256 (const std::string &in, const std::string &hexout)
 
static void TestSHA512 (const std::string &in, const std::string &hexout)
 
static void TestRIPEMD160 (const std::string &in, const std::string &hexout)
 
static void TestHMACSHA256 (const std::string &hexkey, const std::string &hexin, const std::string &hexout)
 
static void TestHMACSHA512 (const std::string &hexkey, const std::string &hexin, const std::string &hexout)
 
static void TestAES256 (const std::string &hexkey, const std::string &hexin, const std::string &hexout)
 
static void TestAES256CBC (const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout)
 
static void TestChaCha20 (const std::string &hex_message, const std::string &hexkey, ChaCha20::Nonce96 nonce, uint32_t seek, const std::string &hexout)
 
static void TestFSChaCha20 (const std::string &hex_plaintext, const std::string &hexkey, uint32_t rekey_interval, const std::string &ciphertext_after_rotation)
 
static void TestPoly1305 (const std::string &hexmessage, const std::string &hexkey, const std::string &hextag)
 
static void TestChaCha20Poly1305 (const std::string &plain_hex, const std::string &aad_hex, const std::string &key_hex, ChaCha20::Nonce96 nonce, const std::string &cipher_hex)
 
static void TestFSChaCha20Poly1305 (const std::string &plain_hex, const std::string &aad_hex, const std::string &key_hex, uint64_t msg_idx, const std::string &cipher_hex)
 
static void TestHKDF_SHA256_32 (const std::string &ikm_hex, const std::string &salt_hex, const std::string &info_hex, const std::string &okm_check_hex)
 
static std::string LongTestString ()
 
 BOOST_AUTO_TEST_CASE (ripemd160_testvectors)
 
 BOOST_AUTO_TEST_CASE (sha1_testvectors)
 
 BOOST_AUTO_TEST_CASE (sha256_testvectors)
 
 BOOST_AUTO_TEST_CASE (sha512_testvectors)
 
 BOOST_AUTO_TEST_CASE (hmac_sha256_testvectors)
 
 BOOST_AUTO_TEST_CASE (hmac_sha512_testvectors)
 
 BOOST_AUTO_TEST_CASE (aes_testvectors)
 
 BOOST_AUTO_TEST_CASE (aes_cbc_testvectors)
 
 BOOST_AUTO_TEST_CASE (chacha20_testvector)
 
 BOOST_AUTO_TEST_CASE (chacha20_midblock)
 
 BOOST_AUTO_TEST_CASE (poly1305_testvector)
 
 BOOST_AUTO_TEST_CASE (chacha20poly1305_testvectors)
 
 BOOST_AUTO_TEST_CASE (hkdf_hmac_sha256_l32_tests)
 
 BOOST_AUTO_TEST_CASE (sha256d64)
 
static void TestSHA3_256 (const std::string &input, const std::string &output)
 
 BOOST_AUTO_TEST_CASE (keccak_tests)
 
 BOOST_AUTO_TEST_CASE (sha3_256_tests)
 
static MuHash3072 FromInt (unsigned char i)
 
 BOOST_AUTO_TEST_CASE (muhash_tests)
 

Variables

const std::string test1 = LongTestString()
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/17]

BOOST_AUTO_TEST_CASE ( aes_cbc_testvectors  )

Definition at line 591 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/17]

BOOST_AUTO_TEST_CASE ( aes_testvectors  )

Definition at line 580 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/17]

BOOST_AUTO_TEST_CASE ( chacha20_midblock  )

Definition at line 823 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/17]

BOOST_AUTO_TEST_CASE ( chacha20_testvector  )

Definition at line 622 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [5/17]

BOOST_AUTO_TEST_CASE ( chacha20poly1305_testvectors  )

Definition at line 962 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [6/17]

BOOST_AUTO_TEST_CASE ( hkdf_hmac_sha256_l32_tests  )

Definition at line 1043 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [7/17]

BOOST_AUTO_TEST_CASE ( hmac_sha256_testvectors  )

Definition at line 459 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [8/17]

BOOST_AUTO_TEST_CASE ( hmac_sha512_testvectors  )

Definition at line 512 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [9/17]

BOOST_AUTO_TEST_CASE ( keccak_tests  )

Definition at line 1101 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [10/17]

BOOST_AUTO_TEST_CASE ( muhash_tests  )

Definition at line 1190 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [11/17]

BOOST_AUTO_TEST_CASE ( poly1305_testvector  )

Definition at line 841 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [12/17]

BOOST_AUTO_TEST_CASE ( ripemd160_testvectors  )

Definition at line 368 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [13/17]

BOOST_AUTO_TEST_CASE ( sha1_testvectors  )

Definition at line 384 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [14/17]

BOOST_AUTO_TEST_CASE ( sha256_testvectors  )

Definition at line 400 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [15/17]

BOOST_AUTO_TEST_CASE ( sha256d64  )

Definition at line 1063 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [16/17]

BOOST_AUTO_TEST_CASE ( sha3_256_tests  )

Definition at line 1121 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [17/17]

BOOST_AUTO_TEST_CASE ( sha512_testvectors  )

Definition at line 422 of file crypto_tests.cpp.

Here is the call graph for this function:

◆ FromInt()

static MuHash3072 FromInt ( unsigned char  i)
static

Definition at line 1185 of file crypto_tests.cpp.

Here is the caller graph for this function:

◆ LongTestString()

static std::string LongTestString ( )
static

Definition at line 353 of file crypto_tests.cpp.

◆ TestAES256()

static void TestAES256 ( const std::string &  hexkey,
const std::string &  hexin,
const std::string &  hexout 
)
static

Definition at line 74 of file crypto_tests.cpp.

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

◆ TestAES256CBC()

static void TestAES256CBC ( const std::string &  hexkey,
const std::string &  hexiv,
bool  pad,
const std::string &  hexin,
const std::string &  hexout 
)
static

Definition at line 93 of file crypto_tests.cpp.

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

◆ TestChaCha20()

static void TestChaCha20 ( const std::string &  hex_message,
const std::string &  hexkey,
ChaCha20::Nonce96  nonce,
uint32_t  seek,
const std::string &  hexout 
)
static

Definition at line 134 of file crypto_tests.cpp.

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

◆ TestChaCha20Poly1305()

static void TestChaCha20Poly1305 ( const std::string &  plain_hex,
const std::string &  aad_hex,
const std::string &  key_hex,
ChaCha20::Nonce96  nonce,
const std::string &  cipher_hex 
)
static

Definition at line 250 of file crypto_tests.cpp.

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

◆ TestFSChaCha20()

static void TestFSChaCha20 ( const std::string &  hex_plaintext,
const std::string &  hexkey,
uint32_t  rekey_interval,
const std::string &  ciphertext_after_rotation 
)
static

Definition at line 185 of file crypto_tests.cpp.

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

◆ TestFSChaCha20Poly1305()

static void TestFSChaCha20Poly1305 ( const std::string &  plain_hex,
const std::string &  aad_hex,
const std::string &  key_hex,
uint64_t  msg_idx,
const std::string &  cipher_hex 
)
static

Definition at line 291 of file crypto_tests.cpp.

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

◆ TestHKDF_SHA256_32()

static void TestHKDF_SHA256_32 ( const std::string &  ikm_hex,
const std::string &  salt_hex,
const std::string &  info_hex,
const std::string &  okm_check_hex 
)
static

Definition at line 337 of file crypto_tests.cpp.

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

◆ TestHMACSHA256()

static void TestHMACSHA256 ( const std::string &  hexkey,
const std::string &  hexin,
const std::string &  hexout 
)
static

Definition at line 64 of file crypto_tests.cpp.

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

◆ TestHMACSHA512()

static void TestHMACSHA512 ( const std::string &  hexkey,
const std::string &  hexin,
const std::string &  hexout 
)
static

Definition at line 69 of file crypto_tests.cpp.

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

◆ TestPoly1305()

static void TestPoly1305 ( const std::string &  hexmessage,
const std::string &  hexkey,
const std::string &  hextag 
)
static

Definition at line 225 of file crypto_tests.cpp.

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

◆ TestRIPEMD160()

static void TestRIPEMD160 ( const std::string &  in,
const std::string &  hexout 
)
static

Definition at line 62 of file crypto_tests.cpp.

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

◆ TestSHA1()

static void TestSHA1 ( const std::string &  in,
const std::string &  hexout 
)
static

Definition at line 59 of file crypto_tests.cpp.

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

◆ TestSHA256()

static void TestSHA256 ( const std::string &  in,
const std::string &  hexout 
)
static

Definition at line 60 of file crypto_tests.cpp.

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

◆ TestSHA3_256()

static void TestSHA3_256 ( const std::string &  input,
const std::string &  output 
)
static

Definition at line 1079 of file crypto_tests.cpp.

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

◆ TestSHA512()

static void TestSHA512 ( const std::string &  in,
const std::string &  hexout 
)
static

Definition at line 61 of file crypto_tests.cpp.

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

◆ TestVector()

template<typename Hasher , typename In , typename Out >
static void TestVector ( const Hasher &  h,
const In &  in,
const Out &  out 
)
static

Definition at line 31 of file crypto_tests.cpp.

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

Variable Documentation

◆ test1

const std::string test1 = LongTestString()

Definition at line 366 of file crypto_tests.cpp.