diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2015-04-21 18:09:37 -0400 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-05-06 17:22:46 +0200 |
commit | a574899671d428682b339ff988363ecaf7dfcd07 (patch) | |
tree | dcf40bfa5daab7b6d18a9f301eb460069859ee8c /src/hash.cpp | |
parent | 8cf1485f3b7a976548128c0d3866747819cbea51 (diff) |
chaincodes: abstract away more chaincode behavior
[squashme] replace struct CCainCode with a typedef uint256 ChainCode
Diffstat (limited to 'src/hash.cpp')
-rw-r--r-- | src/hash.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/hash.cpp b/src/hash.cpp index 20d5d21777..9711293e38 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -5,6 +5,7 @@ #include "hash.h" #include "crypto/common.h" #include "crypto/hmac_sha512.h" +#include "pubkey.h" inline uint32_t ROTL32(uint32_t x, int8_t r) @@ -71,15 +72,12 @@ unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char return h1; } -void BIP32Hash(const unsigned char chainCode[32], unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64]) +void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64]) { unsigned char num[4]; num[0] = (nChild >> 24) & 0xFF; num[1] = (nChild >> 16) & 0xFF; num[2] = (nChild >> 8) & 0xFF; num[3] = (nChild >> 0) & 0xFF; - CHMAC_SHA512(chainCode, 32).Write(&header, 1) - .Write(data, 32) - .Write(num, 4) - .Finalize(output); + CHMAC_SHA512(chainCode.begin(), chainCode.size()).Write(&header, 1).Write(data, 32).Write(num, 4).Finalize(output); } |