1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-11 08:58:08 +00:00
trezor-firmware/core/tools/codegen/gen_keys.py

21 lines
531 B
Python
Raw Normal View History

#!/usr/bin/env python3
import binascii
2017-10-04 13:55:33 +00:00
from trezorlib import ed25519raw
def hex_to_c(s):
2018-07-31 09:35:09 +00:00
return '"\\x' + "\\x".join([s[i : i + 2] for i in range(0, len(s), 2)]) + '"'
2018-07-31 09:35:09 +00:00
for c in "ABCDEFGHI":
print()
seckey = c.encode() * 32
seckey_hex = binascii.hexlify(seckey).decode()
2018-07-31 09:35:09 +00:00
print("seckey", seckey_hex)
print(" ", hex_to_c(seckey_hex))
pubkey = ed25519raw.publickey(seckey)
pubkey_hex = binascii.hexlify(pubkey).decode()
2018-07-31 09:35:09 +00:00
print("pubkey", pubkey_hex)
print(" ", hex_to_c(pubkey_hex))