Cafu Engine
Password.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_PASSWORD_HPP_INCLUDED
8 #define CAFU_PASSWORD_HPP_INCLUDED
9 
10 #include <string>
11 #include "Templates/Array.hpp"
12 
13 
14 namespace cf
15 {
16  namespace Password
17  {
18  /// Generates a string that consists only of ASCII characters.
19  /// The reason for the ASCII characters is that they are assumed to be safe to use and enter on any system.
20  /// @param Length The length of the password string to be generated.
21  /// @param RandomSeed The seed for the random number generator.
22  /// @returns The generated password string.
23  ArrayT<unsigned char> GenerateAsciiPassword(unsigned long Length, unsigned long RandomSeed=0);
24 
25  /// Generates a string that the password generator code uses to obfuscate the cleartext password
26  /// and that the engine uses to de-obfuscate the obfuscated password.
27  ArrayT<unsigned char> GenerateObfuscationString(unsigned long Length);
28 
29  /// Returns the component-wise XOR of String1 and String2.
30  ArrayT<unsigned char> XOR(const ArrayT<unsigned char>& String1, const ArrayT<unsigned char>& String2);
31 
32  /// Returns the values of String as C-code for initializing an array.
33  std::string GenerateArrayCode(const ArrayT<unsigned char>& String);
34 
35  /// Converts an array of unsigned char to a std::string.
36  std::string ToString(const ArrayT<unsigned char>& String);
37  }
38 }
39 
40 #endif
Definition: Renderer.hpp:16