variable change abstraction
This commit is contained in:
+12
-2
@@ -1,7 +1,7 @@
|
||||
from tea3.pretty_print import pretty_print
|
||||
from tea3.cliutils import prompt_int, prompt_choice, prompt_list
|
||||
from tea3.tea3model import Tea3Model
|
||||
from tea3.variable_search import run_exhaustive
|
||||
from tea3.variable_search import run_exhaustive, run_exhaustive_staircase
|
||||
from tea3.sbox import run_sbox
|
||||
from tea3.variable_xor import run_variable_xor, run_exhaustive_xor
|
||||
from tea3.f31f32 import run_f31f32
|
||||
@@ -37,6 +37,12 @@ def run_classic_cli():
|
||||
print("Done.")
|
||||
|
||||
def run_exhaustive_cli():
|
||||
print("\nChoose the variable-change family:")
|
||||
print(" 1) First-row matrix")
|
||||
print(" 2) Staircase matrix")
|
||||
|
||||
family = prompt_choice("Your choice (1 or 2): ", {1, 2})
|
||||
|
||||
print("\nR registers are indexed 0–7; bits within each register are 0–7.")
|
||||
print("Enter -1 to print all bits in the chosen register.")
|
||||
|
||||
@@ -45,7 +51,11 @@ def run_exhaustive_cli():
|
||||
target_bit = prompt_int("Target bit (-1 or 0–7): ", -1, 7)
|
||||
|
||||
print("-" * 50)
|
||||
run_exhaustive(steps, target_reg, target_bit)
|
||||
|
||||
if family == 1:
|
||||
run_exhaustive(steps, target_reg, target_bit)
|
||||
else:
|
||||
run_exhaustive_staircase(steps, target_reg, target_bit)
|
||||
|
||||
print("\n" + "=" * 50)
|
||||
print("Done.")
|
||||
|
||||
Reference in New Issue
Block a user