implemented BIP32/BIP44: create extended hard private key & add separation/identification hardened and non-hardened keys

This commit is contained in:
Alexey Karyabkin 2018-06-08 16:01:10 +04:00
parent 0cce0b70cc
commit 361a9ca90c

View File

@ -146,6 +146,14 @@ def create_expanded_key(key, child_idx):
return None
# Создание усиленного расширенного приватного ключа
def create_expanded_hard_key(key, child_idx):
if isinstance(key, dict):
if key.get('is_private') and child_idx >= FIRST_HARDENED_CHILD:
seed = bytes([0]) + key['key'] + pack('I', child_idx)
return hmac_sha512(key['chain_code'], seed)
return None
def add_private_keys(ext_value, key):
ext_value_int = int.from_bytes(ext_value, byteorder="big")