mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-29 19:08:12 +00:00
core/tests: expand slip39 test_error_location
This commit is contained in:
parent
84d3723ee9
commit
2d8e11e827
@ -156,12 +156,16 @@ class TestCryptoSlip39(unittest.TestCase):
|
||||
|
||||
|
||||
def test_error_location(self):
|
||||
mnemonics = ["duckling enlarge academic academic agency result length solution fridge kidney coal piece deal husband erode duke ajar critical decision keyboard", "theory painting academic academic armed sweater year military elder discuss acne wildlife boring employer fused large satoshi bundle carbon diagnose anatomy hamster leaves tracks paces beyond phantom capital marvel lips brave detect luck"]
|
||||
mnemonics = [
|
||||
"duckling enlarge academic academic agency result length solution fridge kidney coal piece deal husband erode duke ajar critical decision keyboard",
|
||||
"theory painting academic academic armed sweater year military elder discuss acne wildlife boring employer fused large satoshi bundle carbon diagnose anatomy hamster leaves tracks paces beyond phantom capital marvel lips brave detect luck",
|
||||
]
|
||||
for mnemonic in mnemonics:
|
||||
data = tuple(slip39.mnemonic_to_indices(mnemonic))
|
||||
self.assertEqual(slip39.rs1024_error_index(data), None)
|
||||
for i in range(len(data)):
|
||||
error_data = data[:i] + (data[i]^1,) + data[i+1:]
|
||||
for _ in range(50):
|
||||
error_data = error_data = data[:i] + (data[i] ^ (random.uniform(1023) + 1), ) + data[i + 1:]
|
||||
self.assertEqual(slip39.rs1024_error_index(error_data), i)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user