4#include <c++utilities/conversion/binaryconversion.h>
6#include <openssl/conf.h>
7#include <openssl/err.h>
8#include <openssl/evp.h>
9#include <openssl/sha.h>
23static_assert(
Sha256Sum::size == SHA256_DIGEST_LENGTH,
"SHA-256 sum fits into Sha256Sum struct");
31 ERR_load_crypto_strings();
33 OpenSSL_add_all_algorithms();
53 SHA256(buffer, size, hash.data);
63 std::default_random_engine rng(dev());
64 std::uniform_int_distribution<uint32_t> dist(min, max);
Provides a random device using the OpenSSL function RAND_bytes().
PASSWORD_FILE_EXPORT void init()
Initializes OpenSSL.
PASSWORD_FILE_EXPORT void clean()
Cleans resources of OpenSSL.
PASSWORD_FILE_EXPORT std::uint32_t generateRandomNumber(std::uint32_t min, std::uint32_t max)
PASSWORD_FILE_EXPORT Sha256Sum computeSha256Sum(const unsigned char *buffer, std::size_t size)
Computes a SHA-256 sum using OpenSSL.
Contains utility classes and functions.
static constexpr std::size_t size