From 1c5e4a6caf2e70592c80202e7222e895a67b5f10 Mon Sep 17 00:00:00 2001 From: brianluau Date: Mon, 4 May 2009 08:22:53 +0000 Subject: * Added the md5() script command. (follow up to r13719) - Changed kafra storage password to be stored as md5 hash in #kafra_code$. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13728 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/Makefile.in | 4 ++-- src/map/script.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/Makefile.in b/src/map/Makefile.in index 931b86c6a..10cf1ed39 100644 --- a/src/map/Makefile.in +++ b/src/map/Makefile.in @@ -3,12 +3,12 @@ COMMON_OBJ = ../common/obj_all/core.o ../common/obj_all/socket.o ../common/obj_a ../common/obj_all/db.o ../common/obj_all/plugins.o ../common/obj_all/lock.o \ ../common/obj_all/nullpo.o ../common/obj_all/malloc.o ../common/obj_all/showmsg.o \ ../common/obj_all/utils.o ../common/obj_all/strlib.o ../common/obj_all/grfio.o \ - ../common/obj_all/mapindex.o ../common/obj_all/ers.o + ../common/obj_all/mapindex.o ../common/obj_all/ers.o ../common/obj_all/md5calc.o COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h \ ../common/db.h ../common/plugins.h ../common/lock.h \ ../common/nullpo.h ../common/malloc.h ../common/showmsg.h \ ../common/utils.h ../common/strlib.h ../common/grfio.h \ - ../common/mapindex.h ../common/ers.h + ../common/mapindex.h ../common/ers.h ../common/md5calc.h COMMON_SQL_OBJ = ../common/obj_sql/sql.o COMMON_SQL_H = ../common/sql.h diff --git a/src/map/script.c b/src/map/script.c index 0bd5bbb35..a29b08423 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9,6 +9,7 @@ #include "../common/cbasetypes.h" #include "../common/malloc.h" +#include "../common/md5calc.h" #include "../common/lock.h" #include "../common/nullpo.h" #include "../common/showmsg.h" @@ -11900,6 +11901,7 @@ BUILDIN_FUNC(pow) script_pushint(st,(int)i); return 0; } + BUILDIN_FUNC(distance) { int x0, y0, x1, y1; @@ -11914,6 +11916,19 @@ BUILDIN_FUNC(distance) } // <--- [zBuffer] List of mathematics commands + +BUILDIN_FUNC(md5) +{ + const char *tmpstr; + char *md5str; + + tmpstr = script_getstr(st,2); + md5str = (char *)aMallocA((32+1)*sizeof(char)); + MD5_String(tmpstr, md5str); + script_pushstr(st, md5str); + return 0; +} + // [zBuffer] List of dynamic var commands ---> BUILDIN_FUNC(setd) @@ -13900,6 +13915,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(pow,"ii"), BUILDIN_DEF(distance,"iiii"), // <--- [zBuffer] List of mathematics commands + BUILDIN_DEF(md5,"s"), // [zBuffer] List of dynamic var commands ---> BUILDIN_DEF(getd,"*"), BUILDIN_DEF(setd,"*"), -- cgit v1.2.3-70-g09d2