SeComLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
secure_permutation.cpp
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 */
30 #include "secure_permutation.h"
31 
32 namespace SeComLib {
33 namespace Core {
39  SecurePermutation::SecurePermutation (const size_t size) : vectorSize(size) {
40  //store the the Fisher-Yates (Knuth) shuffle permutations
41  for (size_t index = size - 1; index > 0; --index) {
42  //generate a random number in the interval [0, index]
43  size_t randomValue = static_cast<size_t>(RandomProvider::GetInstance().GetRandomInteger(BigInteger(static_cast<unsigned long>(index + 1))).ToUnsignedLong());
44 
45  this->permutations.emplace_back(std::pair<size_t, size_t>(index , randomValue));
46  }
47  }
48 }//namespace Core
49 }//namespace SeComLib
Definition of class SecurePermutation.
SecurePermutation(const size_t size)
Default constructor.
PermutationVector permutations
The vector of permutations.