summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-04-01 22:39:19 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-04-01 22:39:19 +0000
commitbd55cf078aeaae7929cfe5017e22fdf33616b769 (patch)
tree58e83a5a5fd263d38ec3e2c8d9f15c9a8caad31d /src/common
parentd1ad9a53e71f2b2cc51c82259e8a5e23b20c09b8 (diff)
downloadhercules-bd55cf078aeaae7929cfe5017e22fdf33616b769.tar.gz
hercules-bd55cf078aeaae7929cfe5017e22fdf33616b769.tar.bz2
hercules-bd55cf078aeaae7929cfe5017e22fdf33616b769.tar.xz
hercules-bd55cf078aeaae7929cfe5017e22fdf33616b769.zip
* Removed online_check config options. (always active now)
* Clarified char_maintenance config option. * Changed packet 0x2712. (added request_id) * Changed packet 0x2713. (added sex, request_id, version, clienttype; removed email, expiration time, gmlevel) * Delayed user count check and mmo_char_send006b to when the account data arrives. * Created auxiliary function MD5_Salt. (split from a future commit that was getting to big for my taste) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13652 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/md5calc.c10
-rw-r--r--src/common/md5calc.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/common/md5calc.c b/src/common/md5calc.c
index d6a38b865..2178739d6 100644
--- a/src/common/md5calc.c
+++ b/src/common/md5calc.c
@@ -9,6 +9,7 @@
#include "md5calc.h"
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
#ifndef UINT_MAX
#define UINT_MAX 4294967295U
@@ -227,3 +228,12 @@ void MD5_String(const char * string, char * output)
digest[ 8], digest[ 9], digest[10], digest[11],
digest[12], digest[13], digest[14], digest[15]);
}
+
+/** output is a sequence of non-zero characters to be used as password salt. */
+void MD5_Salt(unsigned int len, char * output)
+{
+ unsigned int i;
+ for( i = 0; i < len; ++i )
+ output[i] = (char)(1 + rand() % 255);
+
+}
diff --git a/src/common/md5calc.h b/src/common/md5calc.h
index e35e64219..323affa2c 100644
--- a/src/common/md5calc.h
+++ b/src/common/md5calc.h
@@ -3,5 +3,6 @@
void MD5_String(const char * string, char * output);
void MD5_Binary(const char * string, unsigned char * output);
+void MD5_Salt(unsigned int len, char * output);
#endif /* _MD5CALC_H_ */