abstraction, XOR multiple bits
This commit is contained in:
+8
-6
@@ -3,7 +3,7 @@ from tea3.cliutils import prompt_int, prompt_choice, prompt_list
|
||||
from tea3.tea3model import Tea3Model
|
||||
from tea3.variable_search import run_exhaustive
|
||||
from tea3.sbox import run_sbox
|
||||
from tea3.variable_xor import run_variable_xor, run_exhaustive_two_bit_xor
|
||||
from tea3.variable_xor import run_variable_xor, run_exhaustive_xor
|
||||
from tea3.f31f32 import run_f31f32
|
||||
|
||||
|
||||
@@ -70,15 +70,17 @@ def run_variable_xor_cli():
|
||||
print("\n" + "=" * 50)
|
||||
print("Done.")
|
||||
|
||||
def run_exhaustive_two_bit_xor_cli():
|
||||
def run_exhaustive_xor_cli():
|
||||
print("\nR registers are indexed 0–7; bits within each register are 0–7.")
|
||||
print("This mode checks all 2-bit XOR pairs and prints the best one(s) at each step.")
|
||||
print("This mode searches all XOR combinations of a given size.")
|
||||
|
||||
steps = prompt_int("How many steps? (1–100): ", 1, 100)
|
||||
target_reg = prompt_int("Target register (0–7): ", 0, 7)
|
||||
xor_size = prompt_int("Number of bits to XOR (2–8): ", 2, 8)
|
||||
|
||||
print("-" * 50)
|
||||
run_exhaustive_two_bit_xor(steps, target_reg)
|
||||
|
||||
run_exhaustive_xor(steps=steps, target_reg=target_reg, xor_size=xor_size)
|
||||
|
||||
print("\n" + "=" * 50)
|
||||
print("Done.")
|
||||
@@ -96,7 +98,7 @@ def main():
|
||||
print(" 3) S box analysis")
|
||||
print(" 4) variable XOR")
|
||||
print(" 5) F31, F32 analysis")
|
||||
print(" 6) Exhaustive 2-bit XOR search")
|
||||
print(" 6) Exhaustive XOR search")
|
||||
|
||||
mode = prompt_choice("Your choice (1, 2, 3, 4, 5 or 6): ", {1, 2, 3, 4, 5, 6})
|
||||
|
||||
@@ -111,7 +113,7 @@ def main():
|
||||
elif mode == 5:
|
||||
run_f31f32()
|
||||
elif mode == 6:
|
||||
run_exhaustive_two_bit_xor_cli()
|
||||
run_exhaustive_xor_cli()
|
||||
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user