From 37bbe441256ce69783a137df12b2226990cd0da2 Mon Sep 17 00:00:00 2001 From: Kashiko Koibumi Date: Sat, 3 Aug 2024 05:52:31 +0900 Subject: [PATCH] fix bug in generating deterministic address --- src/highlevelcrypto.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/highlevelcrypto.py b/src/highlevelcrypto.py index b83da2f3..d6575a5f 100644 --- a/src/highlevelcrypto.py +++ b/src/highlevelcrypto.py @@ -7,6 +7,8 @@ High level cryptographic functions based on `.pyelliptic` OpenSSL bindings. `More discussion. `_ """ +from unqstr import unic + import hashlib import os from binascii import hexlify @@ -102,7 +104,7 @@ def random_keys(): def deterministic_keys(passphrase, nonce): """Generate keys from *passphrase* and *nonce* (encoded as varint)""" - priv = hashlib.sha512(passphrase + nonce).digest()[:32] + priv = hashlib.sha512(unic(passphrase).encode("utf-8", "replace") + nonce).digest()[:32] pub = pointMult(priv) return priv, pub