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

16 lines
349 B
Python
Executable File

#!/usr/bin/python3
import ecdsa
# Generate a new random private key
signing_key = ecdsa.SigningKey.generate()
# Get the private key as a byte string
private_key_bytes = signing_key.to_string()
# Convert the private key byte string to a hexadecimal string
private_key_hex = private_key_bytes.hex()
# Print the private key
print(private_key_hex)