1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00
trezor-firmware/src/apps/common/signverify.py

16 lines
401 B
Python
Raw Normal View History

from trezor.crypto.hashlib import sha256
2017-12-22 15:51:02 +00:00
from apps.wallet.sign_tx.signing import write_varint
from apps.common.hash_writer import HashWriter
2017-06-13 17:35:14 +00:00
def message_digest(coin, message):
h = HashWriter(sha256)
write_varint(h, len(coin.signed_message_header))
h.extend(coin.signed_message_header)
write_varint(h, len(message))
h.extend(message)
2017-12-22 15:51:02 +00:00
return sha256(h.get_digest()).digest()