| 355 | } |
| 356 | |
| 357 | void CExtKey::SetSeed(Span<const uint8_t> seed) |
| 358 | { |
| 359 | static const unsigned char hashkey[] = {'B','i','t','c','o','i','n',' ','s','e','e','d'}; |
| 360 | std::vector<unsigned char, secure_allocator<unsigned char>> vout(64); |
| 361 | CHMAC_SHA512{hashkey, sizeof(hashkey)}.Write(seed.data(), seed.size()).Finalize(vout.data()); |
| 362 | key.Set(vout.data(), vout.data() + 32, true); |
| 363 | memcpy(chaincode.begin(), vout.data() + 32, 32); |
| 364 | nDepth = 0; |
| 365 | nChild = 0; |
| 366 | memset(vchFingerprint, 0, sizeof(vchFingerprint)); |
| 367 | } |
| 368 | |
| 369 | CExtPubKey CExtKey::Neuter() const { |
| 370 | CExtPubKey ret; |