chatgpt/encryption-on-apis/gen-ecdsa-private-key-v2.py

14 lines
310 B
Python
Raw Normal View History

2022-12-17 22:39:21 +02:00
#!/usr/bin/python3
import ecdsa
sk = ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1)
# Get the private key as a byte string
private_key_bytes = sk.to_string()
# Convert the private key byte string to a hexadecimal string
private_key_hex = private_key_bytes.hex()
print('private_key: ', private_key_hex)