def BIP32_create_master():
rnd = random.SystemRandom()
a = rnd.randint(0, MAX_INT_PRIVATE_KEY)
i = int((time.time() % 0.01) * 100000)
h = a.to_bytes(32, byteorder="big")
Key = b"Bitcoin seed"
while True:
h = hashlib.sha256(h).digest()
if i > 1:
i -= 1
else:
if int.from_bytes(h, byteorder="big") < MAX_INT_PRIVATE_KEY:
break
I = hmac_sha512(Key, h)
M, C = I[:32], I[32:]
return b'\x04\x88\xAD\xE4\x00\x00\x00\x00\x00\x00\x00\x00\x00' + C + b'\x00' + M
评论列表
文章目录