1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 17:38:39 +00:00
trezor-firmware/core/tools/codegen/gen_keys.py
2019-04-15 19:14:40 +02:00

21 lines
531 B
Python
Executable File

#!/usr/bin/env python3
import binascii
from trezorlib import ed25519raw
def hex_to_c(s):
return '"\\x' + "\\x".join([s[i : i + 2] for i in range(0, len(s), 2)]) + '"'
for c in "ABCDEFGHI":
print()
seckey = c.encode() * 32
seckey_hex = binascii.hexlify(seckey).decode()
print("seckey", seckey_hex)
print(" ", hex_to_c(seckey_hex))
pubkey = ed25519raw.publickey(seckey)
pubkey_hex = binascii.hexlify(pubkey).decode()
print("pubkey", pubkey_hex)
print(" ", hex_to_c(pubkey_hex))