From f07dfe9344bca68dd89f75c8672345086fb311f2 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 14 Oct 2018 16:08:37 +0200 Subject: [PATCH] src/trezor/crypto/base58: refactor hash function names --- src/apps/common/coininfo.py | 6 +++--- src/apps/common/coininfo.py.mako | 6 +++--- src/trezor/crypto/base58.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/apps/common/coininfo.py b/src/apps/common/coininfo.py index 09a37e130c..631b9c87ff 100644 --- a/src/apps/common/coininfo.py +++ b/src/apps/common/coininfo.py @@ -1,6 +1,6 @@ # generated from coininfo.py.mako # do not edit manually! -from trezor.crypto.base58 import blake256_32, groestl512d_32, sha3k_256, sha256d_32 +from trezor.crypto.base58 import blake256d_32, groestl512d_32, keccak_32, sha256d_32 from trezor.crypto.scripts import blake256_ripemd160_digest, sha256_ripemd160_digest @@ -51,11 +51,11 @@ class CoinInfo: self.sign_hash_double = False self.script_hash = sha256_ripemd160_digest elif curve_name == "secp256k1-decred": - self.b58_hash = blake256_32 + self.b58_hash = blake256d_32 self.sign_hash_double = False self.script_hash = blake256_ripemd160_digest elif curve_name == "secp256k1-smart": - self.b58_hash = sha3k_256 + self.b58_hash = keccak_32 self.sign_hash_double = False self.script_hash = sha256_ripemd160_digest else: diff --git a/src/apps/common/coininfo.py.mako b/src/apps/common/coininfo.py.mako index ffd545e29e..2635a546b4 100644 --- a/src/apps/common/coininfo.py.mako +++ b/src/apps/common/coininfo.py.mako @@ -1,6 +1,6 @@ # generated from coininfo.py.mako # do not edit manually! -from trezor.crypto.base58 import blake256_32, groestl512d_32, sha3k_256, sha256d_32 +from trezor.crypto.base58 import blake256d_32, groestl512d_32, keccak_32, sha256d_32 from trezor.crypto.scripts import blake256_ripemd160_digest, sha256_ripemd160_digest @@ -51,11 +51,11 @@ class CoinInfo: self.sign_hash_double = False self.script_hash = sha256_ripemd160_digest elif curve_name == "secp256k1-decred": - self.b58_hash = blake256_32 + self.b58_hash = blake256d_32 self.sign_hash_double = False self.script_hash = blake256_ripemd160_digest elif curve_name == "secp256k1-smart": - self.b58_hash = sha3k_256 + self.b58_hash = keccak_32 self.sign_hash_double = False self.script_hash = sha256_ripemd160_digest else: diff --git a/src/trezor/crypto/base58.py b/src/trezor/crypto/base58.py index f3227bba01..e555532fcd 100644 --- a/src/trezor/crypto/base58.py +++ b/src/trezor/crypto/base58.py @@ -71,13 +71,13 @@ def groestl512d_32(data: bytes) -> bytes: return groestl512(groestl512(data).digest()).digest()[:4] -def blake256_32(data: bytes) -> bytes: +def blake256d_32(data: bytes) -> bytes: from .hashlib import blake256 return blake256(blake256(data).digest()).digest()[:4] -def sha3k_256(data: bytes) -> bytes: +def keccak_32(data: bytes) -> bytes: from .hashlib import sha3_256 return sha3_256(data, keccak=True).digest()[:4]