Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
hkdf_sha256_32.cpp
Go to the documentation of this file.
1// Copyright (c) 2018 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
6
7#include <cassert>
8#include <cstring>
9
11 const std::string &salt) {
12 CHMAC_SHA256((const uint8_t *)salt.data(), salt.size())
15}
16
17void CHKDF_HMAC_SHA256_L32::Expand32(const std::string &info,
18 uint8_t hash[OUTPUT_SIZE]) {
19 // expand a 32byte key (single round)
20 assert(info.size() <= 128);
21 static const uint8_t one[1] = {1};
23 .Write((const uint8_t *)info.data(), info.size())
24 .Write(one, 1)
25 .Finalize(hash);
26}
void Expand32(const std::string &info, uint8_t hash[OUTPUT_SIZE])
CHKDF_HMAC_SHA256_L32(const uint8_t *ikm, size_t ikmlen, const std::string &salt)
A hasher class for HMAC-SHA-256.
Definition hmac_sha256.h:14
CHMAC_SHA256 & Write(const uint8_t *data, size_t len)
Definition hmac_sha256.h:23
void Finalize(uint8_t hash[OUTPUT_SIZE])
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
assert(!tx.IsCoinBase())