mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Add uid param to stats module
This commit is contained in:
@@ -88,6 +88,7 @@ void Application::registerLuaFunctions()
|
||||
|
||||
// Crypt
|
||||
g_lua.registerSingletonClass("g_crypt");
|
||||
g_lua.bindSingletonFunction("g_crypt", "genUUID", &Crypt::genUUID, &g_crypt);
|
||||
g_lua.bindSingletonFunction("g_crypt", "encrypt", &Crypt::encrypt, &g_crypt);
|
||||
g_lua.bindSingletonFunction("g_crypt", "decrypt", &Crypt::decrypt, &g_crypt);
|
||||
g_lua.bindSingletonFunction("g_crypt", "sha1Encode", &Crypt::sha1Encode, &g_crypt);
|
||||
|
@@ -25,6 +25,9 @@
|
||||
#include <framework/core/logger.h>
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_generators.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include <openssl/rsa.h>
|
||||
@@ -147,6 +150,13 @@ std::string Crypt::xorCrypt(const std::string& buffer, const std::string& key)
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string Crypt::genUUID()
|
||||
{
|
||||
boost::uuids::random_generator gen;
|
||||
boost::uuids::uuid u = gen();
|
||||
return boost::uuids::to_string(u);
|
||||
}
|
||||
|
||||
std::string Crypt::genUUIDKey()
|
||||
{
|
||||
boost::hash<boost::uuids::uuid> uuid_hasher;
|
||||
|
@@ -37,7 +37,7 @@ public:
|
||||
std::string base64Encode(const std::string& decoded_string);
|
||||
std::string base64Decode(const std::string& encoded_string);
|
||||
std::string xorCrypt(const std::string& buffer, const std::string& key);
|
||||
std::string genUUIDKey();
|
||||
std::string genUUID();
|
||||
std::string encrypt(const std::string& decrypted_string);
|
||||
std::string decrypt(const std::string& encrypted_string);
|
||||
std::string md5Encode(const std::string& decoded_string, bool upperCase);
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
bool rsaDecrypt(unsigned char *msg, int size);
|
||||
|
||||
private:
|
||||
std::string genUUIDKey();
|
||||
RSA *m_rsa;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user