mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
src/apps/common: add smartcash curve
This commit is contained in:
parent
ef464e1596
commit
33e9dac2fe
@ -1,6 +1,6 @@
|
||||
# generated from coininfo.py.mako
|
||||
# do not edit manually!
|
||||
from trezor.crypto.base58 import blake256_32, groestl512d_32, sha256d_32
|
||||
from trezor.crypto.base58 import blake256_32, groestl512d_32, sha3k_256, sha256d_32
|
||||
from trezor.crypto.scripts import blake256_ripemd160_digest, sha256_ripemd160_digest
|
||||
|
||||
|
||||
@ -54,6 +54,10 @@ class CoinInfo:
|
||||
self.b58_hash = blake256_32
|
||||
self.sign_hash_double = False
|
||||
self.script_hash = blake256_ripemd160_digest
|
||||
elif curve_name == "secp256k1-smart":
|
||||
self.b58_hash = sha3k_256
|
||||
self.sign_hash_double = False
|
||||
self.script_hash = sha256_ripemd160_digest
|
||||
else:
|
||||
self.b58_hash = sha256d_32
|
||||
self.sign_hash_double = True
|
||||
|
@ -1,6 +1,6 @@
|
||||
# generated from coininfo.py.mako
|
||||
# do not edit manually!
|
||||
from trezor.crypto.base58 import blake256_32, groestl512d_32, sha256d_32
|
||||
from trezor.crypto.base58 import blake256_32, groestl512d_32, sha3k_256, sha256d_32
|
||||
from trezor.crypto.scripts import blake256_ripemd160_digest, sha256_ripemd160_digest
|
||||
|
||||
|
||||
@ -54,6 +54,10 @@ class CoinInfo:
|
||||
self.b58_hash = blake256_32
|
||||
self.sign_hash_double = False
|
||||
self.script_hash = blake256_ripemd160_digest
|
||||
elif curve_name == "secp256k1-smart":
|
||||
self.b58_hash = sha3k_256
|
||||
self.sign_hash_double = False
|
||||
self.script_hash = sha256_ripemd160_digest
|
||||
else:
|
||||
self.b58_hash = sha256d_32
|
||||
self.sign_hash_double = True
|
||||
|
@ -77,6 +77,12 @@ def blake256_32(data: bytes) -> bytes:
|
||||
return blake256(blake256(data).digest()).digest()[:4]
|
||||
|
||||
|
||||
def sha3k_256(data: bytes) -> bytes:
|
||||
from .hashlib import sha3_256
|
||||
|
||||
return sha3_256(data, keccak=True).digest()[:4]
|
||||
|
||||
|
||||
def encode_check(data: bytes, digestfunc=sha256d_32) -> str:
|
||||
"""
|
||||
Convert bytes to base58 encoded string, append checksum.
|
||||
|
Loading…
Reference in New Issue
Block a user