MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / SetMaster

Method SetMaster

src/entities/key.cpp:287–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void CExtKey::SetMaster(const uint8_t *seed, uint32_t nSeedLen) {
288 static const char hashkey[] = {'B', 'i', 't', 'c', 'o', 'i', 'n', ' ', 's', 'e', 'e', 'd'};
289 HMAC_SHA512_CTX ctx;
290 HMAC_SHA512_Init(&ctx, hashkey, sizeof(hashkey));
291 HMAC_SHA512_Update(&ctx, seed, nSeedLen);
292 uint8_t out[64];
293 LockObject(out);
294 HMAC_SHA512_Final(out, &ctx);
295 key.Set(&out[0], &out[32], true);
296 memcpy(vchChainCode, &out[32], 32);
297 UnlockObject(out);
298 nDepth = 0;
299 nChild = 0;
300 memset(vchFingerprint, 0, sizeof(vchFingerprint));
301}
302
303CExtPubKey CExtKey::Neuter() const {
304 CExtPubKey ret;

Callers

nothing calls this directly

Calls 7

HMAC_SHA512_InitFunction · 0.85
HMAC_SHA512_UpdateFunction · 0.85
LockObjectFunction · 0.85
HMAC_SHA512_FinalFunction · 0.85
memcpyFunction · 0.85
UnlockObjectFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected