Bitcoin ABC 0.30.7
P2P Digital Currency
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
10CHKDF_HMAC_SHA256_L32::CHKDF_HMAC_SHA256_L32(const uint8_t *ikm, size_t ikmlen,
11 const std::string &salt) {
12 CHMAC_SHA256((const uint8_t *)salt.data(), salt.size())
13 .Write(ikm, ikmlen)
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])
Definition: hmac_sha256.cpp:30
assert(!tx.IsCoinBase())