Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/display bug and type bug #124

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions claasp/cipher_modules/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ def generate_bit_based_vectorized_python_code_string(cipher, store_intermediate_

code.extend([f' {cipher.inputs[i]}=input[{i}]' for i in range(len(cipher.inputs))])
for component in cipher.get_all_components():
start = time.time()
params = prepare_input_bit_based_vectorized_python_code_string(component)
component_types_allowed = ['constant', 'linear_layer', 'concatenate', 'mix_column',
'sbox', 'cipher_output', 'intermediate_output', 'fsr']
Expand All @@ -260,8 +259,6 @@ def generate_bit_based_vectorized_python_code_string(cipher, store_intermediate_
name = component.id
if verbosity and component.type != 'constant':
code.append(f' bit_vector_print_as_hex_values("{name}_output", {name})')
end=time.time()
print(f'{component.id} time = {end-start}')
if store_intermediate_outputs:
code.append(' return intermediateOutputs')
elif CIPHER_INVERSE_SUFFIX in cipher.id:
Expand Down Expand Up @@ -319,7 +316,6 @@ def generate_byte_based_vectorized_python_code_string(cipher, store_intermediate
code.append(f' {cipher.inputs[i]}=input[{i}]')
bit_sizes[cipher.inputs[i]] = cipher.inputs_bit_size[i]
for component in cipher.get_all_components():
start = time.time()
params = prepare_input_byte_based_vectorized_python_code_string(bit_sizes, component)
bit_sizes[component.id] = component.output_bit_size
component_types_allowed = ['constant', 'linear_layer', 'concatenate', 'mix_column',
Expand All @@ -335,8 +331,6 @@ def generate_byte_based_vectorized_python_code_string(cipher, store_intermediate
if verbosity and component.type != 'constant':
code.append(f' byte_vector_print_as_hex_values("{name}_input", {params})')
code.append(f' byte_vector_print_as_hex_values("{name}_output", {name})')
end=time.time()
print(f'{component.id} time = {end-start}')
if store_intermediate_outputs:
code.append(' return intermediateOutputs')
elif CIPHER_INVERSE_SUFFIX in cipher.id:
Expand Down
2 changes: 1 addition & 1 deletion claasp/cipher_modules/neural_network_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def train_neural_distinguisher(cipher, data_generator, starting_round, neural_ne
bs = 5000
x, y = data_generator(samples=training_samples, nr=starting_round)
x_eval, y_eval = data_generator(samples=testing_samples, nr=starting_round)
h = neural_network.fit(x, y, epochs=num_epochs, batch_size=bs, validation_data=(x_eval, y_eval))
h = neural_network.fit(x, y, epochs=int(num_epochs), batch_size=bs, validation_data=(x_eval, y_eval))
acc = np.max(h.history["val_acc"])
print(f'Validation accuracy at {starting_round} rounds :{acc}')
return acc
Expand Down
Loading