mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
HashWriter: getvalue -> get_digest
This commit is contained in:
parent
8880d218b3
commit
54fcbb68df
@ -12,5 +12,5 @@ class HashWriter:
|
|||||||
self.buf[0] = b
|
self.buf[0] = b
|
||||||
self.ctx.update(self.buf)
|
self.ctx.update(self.buf)
|
||||||
|
|
||||||
def getvalue(self, *args) -> bytes:
|
def get_digest(self, *args) -> bytes:
|
||||||
return self.ctx.digest(*args)
|
return self.ctx.digest(*args)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from trezor.crypto.hashlib import sha256
|
from trezor.crypto.hashlib import sha256
|
||||||
|
|
||||||
from apps.wallet.sign_tx.signing import HashWriter, write_varint
|
from apps.wallet.sign_tx.signing import write_varint
|
||||||
|
from apps.common.hash_writer import HashWriter
|
||||||
|
|
||||||
|
|
||||||
def message_digest(coin, message):
|
def message_digest(coin, message):
|
||||||
@ -11,4 +12,4 @@ def message_digest(coin, message):
|
|||||||
write_varint(h, len(message))
|
write_varint(h, len(message))
|
||||||
h.extend(message)
|
h.extend(message)
|
||||||
|
|
||||||
return sha256(h.getvalue()).digest()
|
return sha256(h.get_digest()).digest()
|
||||||
|
@ -70,7 +70,7 @@ async def ethereum_sign_tx(ctx, msg):
|
|||||||
sha.extend(rlp.encode(0))
|
sha.extend(rlp.encode(0))
|
||||||
sha.extend(rlp.encode(0))
|
sha.extend(rlp.encode(0))
|
||||||
|
|
||||||
digest = sha.getvalue(True)
|
digest = sha.get_digest(True)
|
||||||
return await send_signature(ctx, msg, digest)
|
return await send_signature(ctx, msg, digest)
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ def bytearray_with_cap(cap: int) -> bytearray:
|
|||||||
|
|
||||||
|
|
||||||
def get_tx_hash(w, double: bool, reverse: bool=False) -> bytes:
|
def get_tx_hash(w, double: bool, reverse: bool=False) -> bytes:
|
||||||
d = w.getvalue()
|
d = w.get_digest()
|
||||||
if double:
|
if double:
|
||||||
d = sha256(d).digest()
|
d = sha256(d).digest()
|
||||||
if reverse:
|
if reverse:
|
||||||
|
Loading…
Reference in New Issue
Block a user