mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
parent
8caac218ec
commit
faa807f995
@ -47,7 +47,11 @@ def get_seed(passphrase: str = "", progress_bar: bool = True) -> bytes:
|
|||||||
# Identifier or exponent expected but not found
|
# Identifier or exponent expected but not found
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
seed = slip39.decrypt(
|
seed = slip39.decrypt(
|
||||||
mnemonic_secret, passphrase.encode(), iteration_exponent, identifier
|
mnemonic_secret,
|
||||||
|
passphrase.encode(),
|
||||||
|
iteration_exponent,
|
||||||
|
identifier,
|
||||||
|
render_func,
|
||||||
)
|
)
|
||||||
|
|
||||||
return seed
|
return seed
|
||||||
|
@ -37,7 +37,7 @@ from trezor.crypto import hmac, pbkdf2, random
|
|||||||
from trezor.errors import MnemonicError
|
from trezor.errors import MnemonicError
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
from typing import Iterable, Tuple
|
from typing import Callable, Iterable, Tuple
|
||||||
|
|
||||||
Indices = Tuple[int, ...]
|
Indices = Tuple[int, ...]
|
||||||
MnemonicGroups = dict[int, tuple[int, set[tuple[int, bytes]]]]
|
MnemonicGroups = dict[int, tuple[int, set[tuple[int, bytes]]]]
|
||||||
@ -162,6 +162,7 @@ def decrypt(
|
|||||||
passphrase: bytes,
|
passphrase: bytes,
|
||||||
iteration_exponent: int,
|
iteration_exponent: int,
|
||||||
identifier: int,
|
identifier: int,
|
||||||
|
progress_callback: Callable[[int, int], None] | None = None,
|
||||||
) -> bytes:
|
) -> bytes:
|
||||||
"""
|
"""
|
||||||
Converts the Encrypted Master Secret to a Master Secret by applying the passphrase.
|
Converts the Encrypted Master Secret to a Master Secret by applying the passphrase.
|
||||||
@ -177,6 +178,8 @@ def decrypt(
|
|||||||
r,
|
r,
|
||||||
_xor(l, _round_function(i, passphrase, iteration_exponent, salt, r)),
|
_xor(l, _round_function(i, passphrase, iteration_exponent, salt, r)),
|
||||||
)
|
)
|
||||||
|
if progress_callback:
|
||||||
|
progress_callback(_ROUND_COUNT - i, _ROUND_COUNT)
|
||||||
return r + l
|
return r + l
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user