summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-06-29 00:46:11 +0200
committerMattes D <github@xoft.cz>2014-06-29 00:46:11 +0200
commit1b89b997ffb81c38dbe27bc8719efb59a38e14a0 (patch)
treeeee8b1ce2cc05d7eea2d5e54fd3c3e33a8daf953 /src/Bindings/ManualBindings.cpp
parentLikely fixed too quick food depletion (diff)
parentFixed a silly path error in #include. (diff)
downloadcuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.gz
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.bz2
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.lz
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.xz
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.tar.zst
cuberite-1b89b997ffb81c38dbe27bc8719efb59a38e14a0.zip
Diffstat (limited to '')
-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..88d40bfd9 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;
}