| 366 | } |
| 367 | |
| 368 | void CExtKey::SetSeed(std::span<const std::byte> seed) |
| 369 | { |
| 370 | static const unsigned char hashkey[] = {'B','i','t','c','o','i','n',' ','s','e','e','d'}; |
| 371 | std::vector<unsigned char, secure_allocator<unsigned char>> vout(64); |
| 372 | CHMAC_SHA512{hashkey, sizeof(hashkey)}.Write(UCharCast(seed.data()), seed.size()).Finalize(vout.data()); |
| 373 | key.Set(vout.data(), vout.data() + 32, true); |
| 374 | memcpy(chaincode.begin(), vout.data() + 32, 32); |
| 375 | nDepth = 0; |
| 376 | nChild = 0; |
| 377 | memset(vchFingerprint, 0, sizeof(vchFingerprint)); |
| 378 | } |
| 379 | |
| 380 | CExtPubKey CExtKey::Neuter() const { |
| 381 | CExtPubKey ret; |