# root_xprv: a01d6b741b0e74b8d0836ac22b675bbf8e108148ef018d1b000aef1a899a134bd316c0f59e7333520ae1a429504073b2773869e95aa95bb3a4fa0ec76744025c
def seed_to_root_xprv(seed_str):
hc_str = hmac.HMAC(b'Root', bytes.fromhex(seed_str), digestmod=hashlib.sha512).hexdigest()
- # hc_0_int = int.from_bytes(bytes.fromhex(hc_str[0:2]), byteorder='big') & 248
- # hc_0_str = "%0.2x" % hc_0_int
- # new_hc_str = hc_0_str + hc_str[2:]
- # hc_31_int = int.from_bytes(bytes.fromhex(new_hc_str[62:64]), byteorder='big') & 31
- # hc_31_str = "%0.2x" % hc_31_int
- # new_hc_str = new_hc_str[:62] + hc_31_str + new_hc_str[64:]
- # hc_31_int = int.from_bytes(bytes.fromhex(new_hc_str[62:64]), byteorder='big') | 64
- # hc_31_str = "%0.2x" % hc_31_int
- # new_hc_str = new_hc_str[:62] + hc_31_str + new_hc_str[64:]
- # root_xprv_str = new_hc_str
- root_xprv_str = prune_root_scalar(hc_str)
+ root_xprv_str = prune_root_scalar(hc_str[:64])
return root_xprv_str