def test_active_bits(): from crypto.analysis.active_bits import search_minimum_active_bits, count_active_sboxes, display_active_words_progress from crypto.utilities import integer_to_bytes, bytes_to_integer def test_function(state): a, b, c, d = state #sbox_layer(a, b, c, d) print for byte in a + b + c + d: print format(byte, 'b').zfill(8) mix_state(a, b, c, d) print "Output: " for byte in a + b + c + d: print format(byte, 'b').zfill(8) #sbox_layer(a, b, c, d) #mix_state(a, b, c, d) #mix_state(a, b, c, d) #mix_state(a, b, c, d) return a, b, c, d def argument_function(a, b, c, d): return integer_to_bytes(a, 4), integer_to_bytes(b, 4), integer_to_bytes(c, 4), integer_to_bytes(d, 4) def output_function(state): return tuple(bytes_to_integer(section) for section in state) search_minimum_active_bits(test_function, argument_function, output_function)#,
def test_active_bits(): from crypto.analysis.active_bits import search_minimum_active_bits from crypto.utilities import integer_to_bytes, bytes_to_integer def test_function(state): a, b, c, d = state mix_state(a, b, c, d) return a, b, c, d def argument_function(a, b, c, d): return integer_to_bytes(a, 4), integer_to_bytes(b, 4), integer_to_bytes(c, 4), integer_to_bytes(d, 4) def output_function(state): return tuple(bytes_to_integer(section) for section in state) search_minimum_active_bits(test_function, argument_function, output_function)
def test_active_bits(): from crypto.analysis.active_bits import search_minimum_active_bits from crypto.utilities import integer_to_bytes, bytes_to_integer def test_function(state): a, b, c, d = state mix_state(a, b, c, d) return a, b, c, d def argument_function(a, b, c, d): return integer_to_bytes(a, 4), integer_to_bytes(b, 4), integer_to_bytes( c, 4), integer_to_bytes(d, 4) def output_function(state): return tuple(bytes_to_integer(section) for section in state) search_minimum_active_bits(test_function, argument_function, output_function)
def test_permutation_active_bits(): from crypto.analysis.active_bits import search_minimum_active_bits pass_function = lambda *args: args search_minimum_active_bits(lambda args: permutation(*args), pass_function, lambda *args: args[0])
def test_permutation_active_bits(): from crypto.analysis.active_bits import search_minimum_active_bits, THOROUGH_TEST pass_function = lambda *args: args search_minimum_active_bits(lambda args: permutation(*args), pass_function, lambda *args: args[0])#, test_inputs=THOROUGH_TEST)
def test_permutation_active_bits(): from crypto.analysis.active_bits import search_minimum_active_bits, THOROUGH_TEST pass_function = lambda *args: args search_minimum_active_bits( lambda args: permutation(*args), pass_function, lambda *args: args[0]) #, test_inputs=THOROUGH_TEST)
def test_active_bits(): from crypto.analysis.active_bits import search_minimum_active_bits from os import urandom from crypto.utilities import bytes_to_words key = tuple(bytes_to_words(bytearray(urandom(16)), 4)) search_minimum_active_bits(lambda args: bit_permutation(*args + key), lambda *args: args, lambda args: args)
def test_active_bits(): from crypto.analysis.active_bits import search_minimum_active_bits search_minimum_active_bits(lambda args: keyed_permutation(*args), lambda *args: args, lambda args: args)