Обновить py/converter.py

This commit is contained in:
artemuhi 2024-03-23 14:11:31 +03:00
parent 841f091d1c
commit cd94855415

View File

@ -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())