tools.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:bitcoincash-utils 作者: bitaps-com 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号