def visualize_speck(): left = 0 right = 1 key = 2 modulus = 0xFFFFFFFFFFFFFFFF from crypto.analysis.visualization import test_4x64_function, print_state_4x64_256 test_4x64_function(speck_round, (left, right, key, modulus), print_function=lambda data: print_state_4x64_256(data))
def visualize_round_function(): data = [0, 0, 0, 1] CONSTANTS = iter(range(1, 128)) def test_function(a, b, c, d): return round_function(a, b, c, d, next(CONSTANTS)) from crypto.analysis.visualization import test_4x64_function test_4x64_function(test_function, data)
def visualize_bit_shuffle(): data = [0, 0, 15, 1] key = [0, 0, 0, 3] def test_function(a, b, c, d): return bit_shuffle(a, b, c, d, key) from crypto.analysis.visualization import test_4x64_function test_4x64_function(test_function, data)
def test_choice_diffusion(): from crypto.analysis.visualization import test_4x64_function test_4x64_function(choice_diffusion, (1, 2, 4, 8, 1, 2, 4, 8))
def visualize_permutation(): from crypto.analysis.visualization import test_4x64_function, print_state_4x64_256_as_4x64 test_4x64_function(permutation, (0, 0, 0, 1), print_state_4x64_256_as_4x64)
def test_shift_rows(): from crypto.analysis.visualization import test_4x64_function test_4x64_function(shift_rows, [1 | (1 << 16) | (1 << 32) | (1 << 48) for count in range(4)])
def test_test_mixer(): from crypto.analysis.visualization import test_4x64_function, print_state_4x64_256_as_4x64 test_4x64_function(_test_mixer, (0, 0, 0, 1 << 1), print_state_4x64_256_as_4x64)# [1 | (1 << 16) | (1 << 32) | (1 << 48) for count in range(4)])
def test_shuffle_mix(): inputs = [1 | (1 << 16) | (1 << 32) | (1 << 48), 0, 0, 0] inputs[0] = 1 test_4x64_function(shuffle_mix, inputs)
def test_round_function2(): from crypto.analysis.visualization import test_4x64_function test_4x64_function(round_function2, (1, 0, 0, 0, 1))