sbox analysis
This commit is contained in:
+6
-2
@@ -1,6 +1,7 @@
|
||||
from tea3.pretty_print import pretty_print
|
||||
from tea3.tea3model import Tea3Model
|
||||
from tea3.variable_search import run_exhaustive
|
||||
from tea3.sbox import run_sbox
|
||||
|
||||
|
||||
def prompt_int(message: str, lo: int, hi: int) -> int:
|
||||
@@ -83,13 +84,16 @@ def main():
|
||||
print("\nChoose a mode:")
|
||||
print(" 1) Classic inspection")
|
||||
print(" 2) Exhaustive variable-change search")
|
||||
print(" 3) S box analysis")
|
||||
|
||||
mode = prompt_choice("Your choice (1 or 2): ", {1, 2})
|
||||
mode = prompt_choice("Your choice (1, 2 or 3): ", {1, 2, 3})
|
||||
|
||||
if mode == 1:
|
||||
run_classic_cli()
|
||||
else:
|
||||
elif mode == 2:
|
||||
run_exhaustive_cli()
|
||||
else:
|
||||
run_sbox()
|
||||
|
||||
|
||||
main()
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
from sage.crypto.sbox import SBox
|
||||
from sage.crypto.sboxes import AES
|
||||
from tea3.constants import TEA3_SBOX
|
||||
|
||||
def run_sbox():
|
||||
tea3 = SBox(TEA3_SBOX)
|
||||
aes = AES
|
||||
|
||||
print("TEA3 differential uniformity:", tea3.differential_uniformity())
|
||||
print("AES differential uniformity:", aes.differential_uniformity())
|
||||
print()
|
||||
print("TEA3 max DDT coefficient:", tea3.maximal_difference_probability_absolute())
|
||||
print("AES max DDT coefficient:", aes.maximal_difference_probability_absolute())
|
||||
print()
|
||||
print("TEA3 max difference probability:", tea3.maximal_difference_probability())
|
||||
print("AES max difference probability:", aes.maximal_difference_probability())
|
||||
Reference in New Issue
Block a user