diff options
author | Mattes D <github@xoft.cz> | 2014-07-01 15:07:12 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-07-01 15:07:12 +0200 |
commit | 9d843405b282937f9ee70e6ad066ce65a23a02a5 (patch) | |
tree | d7ad93182d00f62766e75fa7611d273dd4ff3d34 /src/Bindings | |
parent | Added a missing endline. (diff) | |
parent | Merge pull request #1140 from mc-server/FixMingw (diff) | |
download | cuberite-9d843405b282937f9ee70e6ad066ce65a23a02a5.tar cuberite-9d843405b282937f9ee70e6ad066ce65a23a02a5.tar.gz cuberite-9d843405b282937f9ee70e6ad066ce65a23a02a5.tar.bz2 cuberite-9d843405b282937f9ee70e6ad066ce65a23a02a5.tar.lz cuberite-9d843405b282937f9ee70e6ad066ce65a23a02a5.tar.xz cuberite-9d843405b282937f9ee70e6ad066ce65a23a02a5.tar.zst cuberite-9d843405b282937f9ee70e6ad066ce65a23a02a5.zip |
Diffstat (limited to 'src/Bindings')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 11 |
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; } |