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

14 lines
363 B
Python
Raw Normal View History

from trezor.crypto.hashlib import sha256
2016-12-08 15:31:10 +00:00
from apps.wallet.sign_tx.signing import HashWriter, write_varint
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)
return sha256(h.getvalue()).digest()