From 361a9ca90cad7523e7219a4ade79a62ec3bf7f4f Mon Sep 17 00:00:00 2001 From: Alexey Karyabkin Date: Fri, 8 Jun 2018 16:01:10 +0400 Subject: [PATCH] implemented BIP32/BIP44: create extended hard private key & add separation/identification hardened and non-hardened keys --- pybtc/hdwallet.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pybtc/hdwallet.py b/pybtc/hdwallet.py index 3db2791..ccf998f 100644 --- a/pybtc/hdwallet.py +++ b/pybtc/hdwallet.py @@ -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")