mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
chore(core): Add HashContextInitable protocol class.
This commit is contained in:
parent
f17a435cdf
commit
83686d1be2
@ -68,7 +68,7 @@ class CoinInfo:
|
|||||||
if curve_name == "secp256k1-groestl":
|
if curve_name == "secp256k1-groestl":
|
||||||
self.b58_hash = groestl512d_32
|
self.b58_hash = groestl512d_32
|
||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
self.script_hash: type[utils.HashContext] = sha256_ripemd160
|
self.script_hash: type[utils.HashContextInitable] = sha256_ripemd160
|
||||||
elif curve_name == "secp256k1-decred":
|
elif curve_name == "secp256k1-decred":
|
||||||
self.b58_hash = blake256d_32
|
self.b58_hash = blake256d_32
|
||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
|
@ -68,7 +68,7 @@ class CoinInfo:
|
|||||||
if curve_name == "secp256k1-groestl":
|
if curve_name == "secp256k1-groestl":
|
||||||
self.b58_hash = groestl512d_32
|
self.b58_hash = groestl512d_32
|
||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
self.script_hash: type[utils.HashContext] = sha256_ripemd160
|
self.script_hash: type[utils.HashContextInitable] = sha256_ripemd160
|
||||||
elif curve_name == "secp256k1-decred":
|
elif curve_name == "secp256k1-decred":
|
||||||
self.b58_hash = blake256d_32
|
self.b58_hash = blake256d_32
|
||||||
self.sign_hash_double = False
|
self.sign_hash_double = False
|
||||||
|
@ -145,17 +145,18 @@ def chunks_intersperse(items: str, size: int, sep: str = "\n") -> Iterator[str]:
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
||||||
class HashContext(Protocol):
|
class HashContext(Protocol):
|
||||||
def __init__( # pylint: disable=super-init-not-called
|
|
||||||
self, __data: bytes = None
|
|
||||||
) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
def update(self, __buf: bytes) -> None:
|
def update(self, __buf: bytes) -> None:
|
||||||
...
|
...
|
||||||
|
|
||||||
def digest(self) -> bytes:
|
def digest(self) -> bytes:
|
||||||
...
|
...
|
||||||
|
|
||||||
|
class HashContextInitable(HashContext, Protocol):
|
||||||
|
def __init__( # pylint: disable=super-init-not-called
|
||||||
|
self, __data: bytes = None
|
||||||
|
) -> None:
|
||||||
|
...
|
||||||
|
|
||||||
class Writer(Protocol):
|
class Writer(Protocol):
|
||||||
def append(self, __b: int) -> None:
|
def append(self, __b: int) -> None:
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user