| 294 | } |
| 295 | |
| 296 | void CExtKey::SetSeed(const unsigned char *seed, unsigned int nSeedLen) { |
| 297 | static const unsigned char hashkey[] = {'B','i','t','c','o','i','n',' ','s','e','e','d'}; |
| 298 | std::vector<unsigned char, secure_allocator<unsigned char>> vout(64); |
| 299 | CHMAC_SHA512(hashkey, sizeof(hashkey)).Write(seed, nSeedLen).Finalize(vout.data()); |
| 300 | key.Set(vout.data(), vout.data() + 32, true); |
| 301 | memcpy(chaincode.begin(), vout.data() + 32, 32); |
| 302 | nDepth = 0; |
| 303 | nChild = 0; |
| 304 | memset(vchFingerprint, 0, sizeof(vchFingerprint)); |
| 305 | } |
| 306 | |
| 307 | CExtPubKey CExtKey::Neuter() const { |
| 308 | CExtPubKey ret; |