Commit ae93927f00a94e6c0fa1c2dce15b539dc9b19679

Authored by Brice Colombier
1 parent d72c4f8ed4
Exists in master

Change split method

Showing 3 changed files with 13 additions and 12 deletions

... ... @@ -53,8 +53,8 @@
53 53 shuffle(reference_response_indexed)
54 54 indices, reference_response = [list(i) for i in zip(*reference_response_indexed)]
55 55  
56   - split(reference_response, block_size)
57   - split(indices, block_size)
  56 + reference_response = split(reference_response, block_size)
  57 + indices = split(indices, block_size)
58 58 parities = get_parities_from_indices(indices, response_on_board)
59 59 blocks_to_correct = []
60 60 reference_response_to_correct = []
1 1 # CASCADE
2 2 Implementation of the CASCADE key reconciliation protocol in Python.
3 3 #### Authors:
4   -Brice Colombier, Lilian Bossuet, David Hély
5   -Laboratoire Hubert Curien
  4 +Brice Colombier, Lilian Bossuet, David Hély
  5 +Laboratoire Hubert Curien
6 6 18 rue Pr. Benoît Lauras, 42000 Saint-Etienne, FRANCE
7 7  
8 8 Source code associated to [this research article](http://eprint.iacr.org/2016/939.pdf).
... ... @@ -6,7 +6,6 @@
6 6 # File: split.py
7 7 # Date : 2016-10-12
8 8  
9   -
10 9 def split(m, size):
11 10  
12 11 """Split a list into blocks of equal size
13 12  
14 13  
15 14  
... ... @@ -17,17 +16,19 @@
17 16 [[0, 1, 0, 1], [0, 1, 0, 1]]
18 17  
19 18 """
  19 +
  20 + m = [m[i:i + size] for i in xrange(0, len(m), size)]
  21 + return m
  22 + # m_ret = m
  23 + # for i in range(int(len(m)/size)):
  24 + # m_ret.append([m_ret.pop(0) for w in range(int(size))])
  25 + # return m_ret
20 26  
21   - m_ret = m
22   - for i in range(int(len(m)/size)):
23   - m_ret.append([m_ret.pop(0) for w in range(int(size))])
24   - return m_ret
25   -
26 27 if __name__ == "__main__":
27 28 message_Alice = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]
28   - message_Bob = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]
  29 + message_Bob = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0]
29 30 size = 8
30   - split(message_Alice, size)
  31 + message_Alice = split(message_Alice, size)
31 32 print(message_Alice)
32 33 print(message_Bob)