Mentions légales du service

Skip to content
Snippets Groups Projects
Commit e132cde7 authored by BOULLE Olivier's avatar BOULLE Olivier
Browse files

reverse the binary string before hashing in encoding

parent 05916d31
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ bsaI_size = 7
extern_extremity_size = primer_size + overhang_size + bsaI_size + buffer_size # size of non-payload dna part at the extern extremities (start of first block and end of last block)
intern_extremity_size = overhang_size + bsaI_size + buffer_size # size of non-payload dna part at the extremities between blocks
max_total_block_size = 500 # maximum allowed size for a complete block
max_total_block_size = 300 # maximum allowed size for a complete block
min_total_block_size = 300 # minimum allowed size for a complete block
force_size_to_max = True # set to false if blocks can have any size between min and max, else force the size of all blocks to be the max size
n_block_max = 10 # maximum assembled number of blocks
......@@ -191,6 +191,7 @@ def encode_file(input_path: str, output_path: str) -> None:
# apply a filter to the binary string -> shuffle the data to avoid long rows of 0 or 1, and avoid rows repetitions
binary_string = binary_string[::-1] # reverse the binary string, because 2 files can have the same start with ziping methods
filtered_binary_string = bdc.apply_binary_filter(binary_string)
......@@ -274,6 +275,7 @@ def decode_file(input_path: str, output_path: str) -> None:
# apply the same filter used in the encoding to the binary string to remove it
binary_string = bdc.apply_binary_filter(binary_string)
binary_string = binary_string[::-1] # reverse the binary string to get the original
# case binaries length is not multiple of 8 -> remove the excess bits at the beginning that have been added in the encoding to get a round number of blocks
rest = len(binary_string) % 8
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment