1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 09:08:07 +00:00
trezor-firmware/src/apps/common/signverify.py
2016-12-08 16:31:10 +01:00

14 lines
363 B
Python

from trezor.crypto.hashlib import sha256
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()