mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-10 23:40:58 +00:00
src/trezor/crypto/base58: refactor hash function names
This commit is contained in:
parent
33e9dac2fe
commit
f07dfe9344
@ -1,6 +1,6 @@
|
|||||||
# generated from coininfo.py.mako
|
# generated from coininfo.py.mako
|
||||||
# do not edit manually!
|
# 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
|
from trezor.crypto.scripts import blake256_ripemd160_digest, sha256_ripemd160_digest
|
||||||
|
|
||||||
|
|
||||||
@ -51,11 +51,11 @@ class CoinInfo:
|
|||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
self.script_hash = sha256_ripemd160_digest
|
self.script_hash = sha256_ripemd160_digest
|
||||||
elif curve_name == "secp256k1-decred":
|
elif curve_name == "secp256k1-decred":
|
||||||
self.b58_hash = blake256_32
|
self.b58_hash = blake256d_32
|
||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
self.script_hash = blake256_ripemd160_digest
|
self.script_hash = blake256_ripemd160_digest
|
||||||
elif curve_name == "secp256k1-smart":
|
elif curve_name == "secp256k1-smart":
|
||||||
self.b58_hash = sha3k_256
|
self.b58_hash = keccak_32
|
||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
self.script_hash = sha256_ripemd160_digest
|
self.script_hash = sha256_ripemd160_digest
|
||||||
else:
|
else:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# generated from coininfo.py.mako
|
# generated from coininfo.py.mako
|
||||||
# do not edit manually!
|
# 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
|
from trezor.crypto.scripts import blake256_ripemd160_digest, sha256_ripemd160_digest
|
||||||
|
|
||||||
|
|
||||||
@ -51,11 +51,11 @@ class CoinInfo:
|
|||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
self.script_hash = sha256_ripemd160_digest
|
self.script_hash = sha256_ripemd160_digest
|
||||||
elif curve_name == "secp256k1-decred":
|
elif curve_name == "secp256k1-decred":
|
||||||
self.b58_hash = blake256_32
|
self.b58_hash = blake256d_32
|
||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
self.script_hash = blake256_ripemd160_digest
|
self.script_hash = blake256_ripemd160_digest
|
||||||
elif curve_name == "secp256k1-smart":
|
elif curve_name == "secp256k1-smart":
|
||||||
self.b58_hash = sha3k_256
|
self.b58_hash = keccak_32
|
||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
self.script_hash = sha256_ripemd160_digest
|
self.script_hash = sha256_ripemd160_digest
|
||||||
else:
|
else:
|
||||||
|
@ -71,13 +71,13 @@ def groestl512d_32(data: bytes) -> bytes:
|
|||||||
return groestl512(groestl512(data).digest()).digest()[:4]
|
return groestl512(groestl512(data).digest()).digest()[:4]
|
||||||
|
|
||||||
|
|
||||||
def blake256_32(data: bytes) -> bytes:
|
def blake256d_32(data: bytes) -> bytes:
|
||||||
from .hashlib import blake256
|
from .hashlib import blake256
|
||||||
|
|
||||||
return blake256(blake256(data).digest()).digest()[:4]
|
return blake256(blake256(data).digest()).digest()[:4]
|
||||||
|
|
||||||
|
|
||||||
def sha3k_256(data: bytes) -> bytes:
|
def keccak_32(data: bytes) -> bytes:
|
||||||
from .hashlib import sha3_256
|
from .hashlib import sha3_256
|
||||||
|
|
||||||
return sha3_256(data, keccak=True).digest()[:4]
|
return sha3_256(data, keccak=True).digest()[:4]
|
||||||
|
Loading…
Reference in New Issue
Block a user