mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
Lua更新
This commit is contained in:
@@ -31,6 +31,9 @@ namespace UniLua
|
||||
new NameFuncPair("clear", OS_Clear),
|
||||
new NameFuncPair("getusername", OS_Getusername),
|
||||
new NameFuncPair("isadmin", OS_Isadmin),
|
||||
new NameFuncPair("sha256", OS_Sha256),
|
||||
new NameFuncPair("base64encrypt", OS_Base64Encrypt),
|
||||
new NameFuncPair("base64decrypt", OS_Base64Decrypt),
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -177,6 +180,30 @@ namespace UniLua
|
||||
lua.PushBoolean(isAdmin);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int OS_Sha256( ILuaState lua )
|
||||
{
|
||||
string input = lua.L_CheckString(1);
|
||||
string hash = CMLeonOS.UserSystem.HashPasswordSha256(input) ?? "";
|
||||
lua.PushString(hash);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int OS_Base64Encrypt( ILuaState lua )
|
||||
{
|
||||
string input = lua.L_CheckString(1);
|
||||
string encoded = CMLeonOS.Base64Helper.Encode(input);
|
||||
lua.PushString(encoded);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int OS_Base64Decrypt( ILuaState lua )
|
||||
{
|
||||
string input = lua.L_CheckString(1);
|
||||
string decoded = CMLeonOS.Base64Helper.Decode(input);
|
||||
lua.PushString(decoded);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user