1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #ifndef USERMANAGEMENTSHARED_H
- #define USERMANAGEMENTSHARED_H
- #include <string>
- enum enPrivilegeLevel
- {
- Operator = 0,
- Technician,
- Engineer,
- Administrator,
- Adm,
- SeniorOperator
- };
- const int g_nKey[7] = { 9, 9, 7, 8, 5, 6, 7};
- class JEncryption
- {
- public:
- JEncryption();
- ~JEncryption();
- public:
-
- static std::string Encryption(const std::string str)
- {
- std::string c = str;
- int len = c.size();
- for(int i = 0; i < len; i++)
- {
- c[i] = c[i] ^ g_nKey[i % 7];
- }
- return c;
- }
-
- static std::string Decode(const std::string str)
- {
- std::string c = str;
- int len = c.size();
- for(int i = 0; i < len; i++)
- {
- c[i] = c[i] ^ g_nKey[i % 7];
- }
- return c;
- }
- };
- #endif
|