aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2014-10-28 17:35:24 -0400
committerCory Fields <cory-nospam-@coryfields.com>2014-10-31 01:13:07 -0400
commit78c228c6e5f35b6f2e1917d8677694779f837618 (patch)
treed97155c6a1d16d5083dfd4fa70dd565679e99600
parent900078aeb4088b63ee271e774a00ccd126628528 (diff)
boost: moveonly: move BIP32Hash to hash.h
-rw-r--r--src/hash.cpp13
-rw-r--r--src/hash.h1
-rw-r--r--src/key.cpp12
3 files changed, 14 insertions, 12 deletions
diff --git a/src/hash.cpp b/src/hash.cpp
index 218607a6fd..29376b45aa 100644
--- a/src/hash.cpp
+++ b/src/hash.cpp
@@ -63,3 +63,16 @@ 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])
+{
+ 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);
+}
diff --git a/src/hash.h b/src/hash.h
index bdcd4afb47..53a7672a8f 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -159,4 +159,5 @@ uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash);
+void BIP32Hash(const unsigned char chainCode[32], unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64]);
#endif // BITCOIN_HASH_H
diff --git a/src/key.cpp b/src/key.cpp
index 925b80ba0f..2369aa2521 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -237,18 +237,6 @@ bool CPubKey::Decompress() {
return true;
}
-void static BIP32Hash(const unsigned char chainCode[32], 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);
-}
-
bool CKey::Derive(CKey& keyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const {
assert(IsValid());
assert(IsCompressed());