// *****************************************************************************
// 版权所有(C)2023~2099 上海骄成超声波技术有限公司
// 保留所有权利
// *****************************************************************************
// 作者 : 杨坚
// 版本 : 1.0
// 功能说明:
//          用户管理共享
// *****************************************************************************
#ifndef USERMANAGEMENTSHARED_H
#define USERMANAGEMENTSHARED_H
#include <string>

// 特权等级
enum enPrivilegeLevel
{
    Operator = 0, //操作工
    Technician,  // 技术员
    Engineer,    //工程师
    Administrator, // 管理员
    Adm, // 这个目前不知道干啥用的....
    SeniorOperator
};


// 简单字符串亦或
//加密解密key
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 // USERMANAGEMENTSHARED_H