Add uid param to stats module

This commit is contained in:
Eduardo Bart
2012-08-22 22:50:03 -03:00
parent ecd1ec5c0d
commit bdbce01c97
4 changed files with 34 additions and 10 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
};