diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-10-05 23:53:33 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-10-05 23:53:33 +0200 |
commit | 7fc487afd1249eee97651a0eec0630d7e421924f (patch) | |
tree | 9c5af1b70afc8d53a9e0bb96a012fe0429c1965e /src/hash.cpp | |
parent | 113b863f0773999497f952daa6539a03a66a9de3 (diff) |
refactor: use `{Read,Write}BE32` helpers for BIP32 nChild (de)serialization
Diffstat (limited to 'src/hash.cpp')
-rw-r--r-- | src/hash.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/hash.cpp b/src/hash.cpp index 92c923fbd2..0e5bd975e4 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -75,10 +75,7 @@ unsigned int MurmurHash3(unsigned int nHashSeed, Span<const unsigned char> vData 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; + WriteBE32(num, nChild); CHMAC_SHA512(chainCode.begin(), chainCode.size()).Write(&header, 1).Write(data, 32).Write(num, 4).Finalize(output); } |