Commit abd1d15d38fa9fa6863635ba79112d98332d6a6c

Authored by Brice Colombier
1 parent 48c73d73fa
Exists in master

CASCADE almost working...

Showing 2 changed files with 3 additions and 6 deletions

CASCADE/cascade.py View file @ abd1d15
... ... @@ -21,8 +21,6 @@
21 21  
22 22 powers = [2**i for i in range(12)] # Up to 512-bit responses
23 23 if (not len(reference_response) in powers):
24   - print reference_response
25   - print len(reference_response)
26 24 raise ValueError('Message length is not a power of two or is too large')
27 25  
28 26 if not initial_block_size:
... ... @@ -48,7 +46,6 @@
48 46 if block_size < len(reference_response)/2:
49 47 block_size *= 2
50 48 block_size_increased = True
51   - print "Pass :", passe, ", block size", block_size
52 49 reference_response_indexed = zip(indices, reference_response)
53 50 if passe > 0:
54 51 rd.shuffle(reference_response_indexed)
... ... @@ -56,7 +53,6 @@
56 53  
57 54 split.split(reference_response, block_size)
58 55 split.split(indices, block_size)
59   - print "Parity check"
60 56 parities = gpfi.get_parities_from_indices(indices, tclsh, board_manager)
61 57 blocks_to_correct = []
62 58 reference_response_to_correct = []
... ... @@ -72,7 +68,6 @@
72 68 if passe > 0:
73 69 even_parity_blocks.append(indices[block_index])
74 70 if blocks_to_correct:
75   - print "Narrow down to single bit errors to correct "+str(len(blocks_to_correct))+" blocks"
76 71 while len(blocks_to_correct[0]) > 2:
77 72 reference_response_to_correct, blocks_to_correct = bi_par.binary_par(reference_response_to_correct, blocks_to_correct, tclsh, board_manager)
78 73 # Final BINARY execution where single PUF bits are queried from the board
79 74  
... ... @@ -87,11 +82,11 @@
87 82 reference_response = fl.flatten(reference_response)
88 83 if blocks_to_correct:
89 84 # Error correction step
  85 + print indices_to_flip
90 86 fb.flip_bits(reference_response, indices_to_flip, indices)
91 87 indices_to_flip = []
92 88 blocks_to_correct = []
93 89 # if passe > 0:
94   - # print "Backtracking process"
95 90 # # Backtracking process
96 91 # while odd_parity_blocks:
97 92 # backtracked_pos = 0
... ... @@ -310,12 +310,14 @@
310 310 def perform_reconciliation(self):
311 311 self.tcl_obj.eval(self.board_manager.reset_boards())
312 312 self.tcl_obj.eval(self.board_manager.generate_response())
  313 + print response_converter_to_hex(self.server_reference_response)
313 314 self.server_reference_response = cascade(self.server_reference_response,
314 315 0.02,
315 316 int(self.reconciliation_parameter_number_of_passes_spinbox.get()),
316 317 self.tcl_obj,
317 318 self.board_manager,
318 319 int(self.reconciliation_parameter_initial_block_size_spinbox.get()))
  320 + print response_converter_to_hex(self.server_reference_response)
319 321 print ("Reconciliation done")
320 322  
321 323 def reset_board(self):