summaryrefslogtreecommitdiff
path: root/src/common/md5calc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/md5calc.c')
-rw-r--r--src/common/md5calc.c10
1 files changed, 10 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);
+
+}