Exemple #1
0
 def from_seed(cls, seed):
     # This hard-coded message string seems to be coin-independent...
     hmac = hmac_sha512(b'Bitcoin seed', seed)
     privkey, chain_code = hmac[:32], hmac[32:]
     return cls(privkey, chain_code, 0, 0)
Exemple #2
0
 def _hmac_sha512(self, msg):
     '''Use SHA-512 to provide an HMAC, returned as a pair of 32-byte
     objects.
     '''
     hmac = hmac_sha512(self.chain_code, msg)
     return hmac[:32], hmac[32:]
Exemple #3
0
def test_hmac_sha512():
    assert lib_hash.hmac_sha512(
        b'key', b'message'
    ) == b"\xe4w8M|\xa2)\xdd\x14&\xe6Kc\xeb\xf2\xd3n\xbdm~f\x9ag5BNr\xeal\x01\xd3\xf8\xb5n\xb3\x9c6\xd8#/T'\x99\x9b\x8d\x1a?\x9c\xd1\x12\x8f\xc6\x9fMu\xb44!h\x10\xfa6~\x98"