COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Keyfile.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef VR_KEYFILE_H
9 #define VR_KEYFILE_H
10 
11 #include <util/coExport.h>
12 #include <vector>
13 
14 //#include <stdio.h>
15 
16 namespace Keyfile
17 {
18 std::vector<unsigned char> getKey()
19 {
20  vector<unsigned char> retVal;
21  for (int i = 0; i < 32; ++i)
22  {
23  retVal.push_back((unsigned char)(((i + 11) * (i + 12) + 17) % 255));
24  }
25  retVal[8] = 87;
26  retVal[15] = 12;
27  retVal[29] = 143;
28  retVal[retVal[15]] = 212;
29  for (int i = 0; i < 32; ++i)
30  {
31  retVal[i] = 255 - retVal[i];
32  }
33  retVal[28] = 117;
34 
35  /*
36  // NEVER COMPILE FOR RELEASE WITH THE FOLLOWING CODE UNCOMMENTED
37  FILE *outfile = fopen ("C:\\cc.key", "wb");
38  for (int i=0; i<32; ++i)
39  {
40  fputc(retVal[i], outfile);
41  }
42  fclose(outfile);
43  */
44 
45  return retVal;
46 }
47 }
48 
49 #endif
std::vector< unsigned char > getKey()
Definition: Keyfile.h:18