From 54fcbb68df2b71984267fe1769a89f4617775b87 Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Fri, 22 Dec 2017 16:51:02 +0100 Subject: [PATCH] HashWriter: getvalue -> get_digest --- src/apps/common/hash_writer.py | 2 +- src/apps/common/signverify.py | 5 +++-- src/apps/ethereum/sign_tx.py | 2 +- src/apps/wallet/sign_tx/writers.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/apps/common/hash_writer.py b/src/apps/common/hash_writer.py index e546dad792..025e5a2e2a 100644 --- a/src/apps/common/hash_writer.py +++ b/src/apps/common/hash_writer.py @@ -12,5 +12,5 @@ class HashWriter: self.buf[0] = b self.ctx.update(self.buf) - def getvalue(self, *args) -> bytes: + def get_digest(self, *args) -> bytes: return self.ctx.digest(*args) diff --git a/src/apps/common/signverify.py b/src/apps/common/signverify.py index 8cc5c8ce11..53468f62df 100644 --- a/src/apps/common/signverify.py +++ b/src/apps/common/signverify.py @@ -1,6 +1,7 @@ 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): @@ -11,4 +12,4 @@ def message_digest(coin, message): write_varint(h, len(message)) h.extend(message) - return sha256(h.getvalue()).digest() + return sha256(h.get_digest()).digest() diff --git a/src/apps/ethereum/sign_tx.py b/src/apps/ethereum/sign_tx.py index 648430dea0..f0b79ea961 100644 --- a/src/apps/ethereum/sign_tx.py +++ b/src/apps/ethereum/sign_tx.py @@ -70,7 +70,7 @@ async def ethereum_sign_tx(ctx, msg): 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) diff --git a/src/apps/wallet/sign_tx/writers.py b/src/apps/wallet/sign_tx/writers.py index b246974fbf..37c5821add 100644 --- a/src/apps/wallet/sign_tx/writers.py +++ b/src/apps/wallet/sign_tx/writers.py @@ -106,7 +106,7 @@ def bytearray_with_cap(cap: int) -> bytearray: def get_tx_hash(w, double: bool, reverse: bool=False) -> bytes: - d = w.getvalue() + d = w.get_digest() if double: d = sha256(d).digest() if reverse: