-rwxr-xr-x 908 cryptattacktester-20230614/aes128.py raw
#!/usr/bin/env python3
import sys
import subprocess
import multiprocessing
for K in range(1,129):
Crange = [K-1,K] if K in [2,3,4] else [K]
for C in Crange:
I = (1<<K)-1
KC = f'K={K},C={C}'
KCI = f'K={K},C={C},I={I}'
searchparams = subprocess.run(['./searchparams','problem=aes128',KCI],capture_output=True,universal_newlines=True,check=True)
searchparams = searchparams.stdout.splitlines()[-1]
print(searchparams)
sys.stdout.flush()
searchparams = searchparams.split()
assert searchparams[0] == 'searchparams'
assert searchparams[1] == 'problem=aes128'
assert searchparams[2] == KC
assert searchparams[3] == 'attack=aes128_enum'
attackparams = searchparams[4]
if K <= 10:
subprocess.run(['./circuitcost','problem=aes128',KC,attackparams])
subprocess.run(['./circuitprob','problem=aes128',KC,attackparams,'trialfactor=100000'])