diff --git a/py/converter.py b/py/converter.py index 65c8d16..96dc0bf 100644 --- a/py/converter.py +++ b/py/converter.py @@ -28,25 +28,25 @@ import json from ecdsa import SigningKey, VerifyingKey, SECP256k1 from ecdsa.util import PRNG -f = open('text.txt', 'r') +f = open('temp.json', 'r') request = json.load(f) f.close() def p2h(data, keymode): if(keymode=="sk"): - sk = SigningKey.from_pem(data, curve=SECP256k1) + sk = SigningKey.from_pem(data.encode(), curve=SECP256k1) print(sk.to_string().hex()) elif(keymode=="vk"): - vk = VerifyingKey.from_pem(data, curve=SECP256k1) + vk = VerifyingKey.from_pem(data.encode(), curve=SECP256k1) print(vk.to_string().hex()) def h2p(data, keymode): if(keymode=="sk"): - sk = SigningKey.from_string(b16decode(data), curve=SECP256k1) - print(sk.to_pem()) + sk = SigningKey.from_string(b16decode(data.encode()), curve=SECP256k1) + print(sk.to_pem().decode()) elif(keymode=="vk"): - vk = VerifyingKey.from_string(b16decode(data), curve=SECP256k1) - print(vk.to_pem()) + vk = VerifyingKey.from_string(b16decode(data.encode()), curve=SECP256k1) + print(vk.to_pem().decode()) def seed2hkey(data, keymode): seed = PRNG(data.encode())