mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-28 09:08:07 +00:00
14 lines
363 B
Python
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()
|