コード例 #1
0
ファイル: bip32.py プロジェクト: zhyniq/lbry-sdk
 def from_seed(cls, ledger, 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(ledger, privkey, chain_code, 0, 0)
コード例 #2
0
ファイル: bip32.py プロジェクト: zhyniq/lbry-sdk
 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:]
コード例 #3
0
ファイル: mnemonic.py プロジェクト: zhyniq/lbry-sdk
def is_new_seed(seed, prefix):
    seed = normalize_text(seed)
    seed_hash = hexlify(hmac_sha512(b"Seed version", seed.encode('utf8')))
    return seed_hash.startswith(prefix)