summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-06-27 19:34:53 +0200
committerMattes D <github@xoft.cz>2014-06-27 19:34:53 +0200
commit563f706422554d1d8ff1121b9613ab9d34951a3b (patch)
tree3823d1dd610fafeedea79125706b56cd7b21c9a2 /src/Bindings/ManualBindings.cpp
parentCMake: pthread is used only on Unix. (diff)
downloadcuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar
cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.gz
cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.bz2
cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.lz
cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.xz
cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.tar.zst
cuberite-563f706422554d1d8ff1121b9613ab9d34951a3b.zip
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r--src/Bindings/ManualBindings.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index f52d970bf..3692851eb 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -4,7 +4,7 @@
#include "ManualBindings.h"
#undef TOLUA_TEMPLATE_BIND
#include "tolua++/include/tolua++.h"
-
+#include "polarssl\md5.h"
#include "Plugin.h"
#include "PluginLua.h"
#include "PluginManager.h"
@@ -25,7 +25,6 @@
#include "../BlockEntities/NoteEntity.h"
#include "../BlockEntities/MobHeadEntity.h"
#include "../BlockEntities/FlowerPotEntity.h"
-#include "md5/md5.h"
#include "../LineBlockTracer.h"
#include "../WorldStorage/SchematicFileSerializer.h"
#include "../CompositeChat.h"
@@ -2001,9 +2000,11 @@ static int tolua_cPlugin_Call(lua_State * tolua_S)
static int tolua_md5(lua_State* tolua_S)
{
- std::string SourceString = tolua_tostring(tolua_S, 1, 0);
- std::string CryptedString = md5( SourceString );
- tolua_pushstring( tolua_S, CryptedString.c_str() );
+ unsigned char Output[16];
+ size_t len = 0;
+ const unsigned char * SourceString = (const unsigned char *)lua_tolstring(tolua_S, 1, &len);
+ md5(SourceString, len, Output);
+ lua_pushlstring(tolua_S, (const char *)Output, ARRAYCOUNT(Output));
return 1;
}