SeComLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
secure_permutation.h
Go to the documentation of this file.
1 /*
2 SeComLib
3 Copyright 2012-2013 TU Delft, Information Security & Privacy Lab (http://isplab.tudelft.nl/)
4 
5 Contributors:
6 Inald Lagendijk (R.L.Lagendijk@TUDelft.nl)
7 Mihai Todor (todormihai@gmail.com)
8 Thijs Veugen (P.J.M.Veugen@tudelft.nl)
9 Zekeriya Erkin (z.erkin@tudelft.nl)
10 
11 Licensed under the Apache License, Version 2.0 (the "License");
12 you may not use this file except in compliance with the License.
13 You may obtain a copy of the License at
14 
15 http://www.apache.org/licenses/LICENSE-2.0
16 
17 Unless required by applicable law or agreed to in writing, software
18 distributed under the License is distributed on an "AS IS" BASIS,
19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 See the License for the specific language governing permissions and
21 limitations under the License.
22 */
29 #ifndef SECURE_PERMUTATION_HEADER_GUARD
30 #define SECURE_PERMUTATION_HEADER_GUARD
31 
32 #include "random_provider.h"
33 
34 //include C++ headers
35 #include <deque>
36 
37 namespace SeComLib {
38 namespace Core {
43  public:
45  typedef std::deque<std::pair<size_t, size_t>> PermutationVector;
46 
48  SecurePermutation (const size_t size);
49 
52 
54  template <typename T_DataType>
55  void Permute (T_DataType &vector) const;
56 
58  template <typename T_DataType>
59  void InvertPermutation (T_DataType &vector) const;
60 
61  private:
63  const size_t vectorSize;
64 
67 
70 
73  };
74 }//namespace Core
75 }//namespace SeComLib
76 
77 //Separate the implementation from the declaration of template methods
78 #include "secure_permutation.hpp"
79 
80 #endif//SECURE_PERMUTATION_HEADER_GUARD
SecurePermutation(const size_t size)
Default constructor.
std::deque< std::pair< size_t, size_t > > PermutationVector
Define the permutation map container.
SecurePermutation operator=(SecurePermutation const &)
Copy assignment operator - not implemented.
Permutation class which implements the Fisher-Yates (Knuth) shuffle algorithm.
Implementation of template members from class SecurePermutation. To be included in secure_permutation...
void InvertPermutation(T_DataType &vector) const
Applies the permutations in reverse to the input verctor.
Defines RandomProvider.
PermutationVector permutations
The vector of permutations.
void Permute(T_DataType &vector) const
Applies the permutations to the input vector.
const size_t vectorSize
The size of the vectors that can be permuted.