OSDN Git Service

update
authorChengcheng Zhang <943420582@qq.com>
Fri, 21 Dec 2018 07:12:01 +0000 (15:12 +0800)
committerChengcheng Zhang <943420582@qq.com>
Fri, 21 Dec 2018 07:12:01 +0000 (15:12 +0800)
app/model/key.py

index ed2a284..071f06e 100644 (file)
@@ -107,17 +107,7 @@ def prune_root_scalar(s_str):
 #   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