@@ -587,26 +587,43 @@ def do_split_seed(self, arg):
587
587
maximum = 16 ,
588
588
)
589
589
passphrase = b""
590
+ # Max possible combos is 12,870 (with 8-of-16)
591
+ testing_limit = 12870
590
592
if self .ADVANCED_MODE :
591
593
add_passphrase = _get_bool (
592
594
"Do you want to add a passphrase?" , default = False
593
595
)
594
596
if add_passphrase :
595
597
passphrase = _get_confirmed_pw ().encode ("ascii" )
598
+ if _get_bool (
599
+ "Do you want to limit how many of these shares you test (for faster results)?" ,
600
+ default = False ,
601
+ ):
602
+ testing_limit = _get_int (
603
+ "How many combinations would you like to test?" ,
604
+ default = 1000 ,
605
+ minimum = k ,
606
+ maximum = testing_limit ,
607
+ )
596
608
shares = ShareSet .generate_shares (mnemonic , k , n , passphrase = passphrase )
597
609
# test the shares (cap at 1000 combinations)
598
- print ( "testing combinations..." )
599
- iterations = 0
600
- for combo in combinations ( shares , k ):
601
- iterations += 1
602
- if iterations > 1000 :
610
+ print_yellow (
611
+ "Testing share combinations to be certain they will recover your seed phrase"
612
+ )
613
+ for cnt , combo in enumerate ( combinations ( shares , k )):
614
+ if cnt > testing_limit :
603
615
break
604
- elif iterations % 10 :
605
- print ("." , end = "" , flush = True )
606
616
calculated = ShareSet .recover_mnemonic (combo , passphrase )
607
617
if calculated != mnemonic :
608
618
# we should never reach this line
609
619
raise RuntimeError (f"Bad shares { calculated } for mnemonic { mnemonic } " )
620
+ if cnt % 10 == 0 :
621
+ print ("." , end = "" , flush = True )
622
+
623
+ print_yellow (
624
+ f"\n Succesfully tested { 'ALL ' if testing_limit == 12870 else '' } { cnt } combinations"
625
+ )
626
+
610
627
print ("\n " )
611
628
share_mnemonics = "\n \n " .join (shares )
612
629
if passphrase :
0 commit comments