CLI changes
This commit is contained in:
@@ -25,7 +25,7 @@ def apply_variable_change(model, coeffs):
|
||||
new_R.append(row)
|
||||
return new_R
|
||||
|
||||
def run_exhaustive(steps: int, target_reg: int = 0):
|
||||
def run_exhaustive(steps: int, target_reg: int = 0, target_bit: int = -1):
|
||||
model = Tea3Model()
|
||||
for _ in range(steps):
|
||||
model.step()
|
||||
@@ -37,6 +37,14 @@ def run_exhaustive(steps: int, target_reg: int = 0):
|
||||
|
||||
label = "".join(map(str, coeffs))
|
||||
print(f"\n[{idx:02d}] (a1,a2,a3,a4) = {label}")
|
||||
for j in range(8):
|
||||
|
||||
if target_bit == -1:
|
||||
bits = range(8)
|
||||
else:
|
||||
if not (0 <= target_bit < 8):
|
||||
raise ValueError("target_bit must be in [0, 7] or -1")
|
||||
bits = [target_bit]
|
||||
|
||||
for j in bits:
|
||||
poly = new_R[target_reg][j]
|
||||
print(f" R[{target_reg}][{j}] = {pretty_print(poly)}")
|
||||
|
||||
Reference in New Issue
Block a user