summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-10-17 20:42:40 +0000
committerrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-10-17 20:42:40 +0000
commit9bf8366451b60148699657ed966c0913fbae9465 (patch)
tree3a48a1aaa582ec259657ff1029dd691b3a99fb92 /src/misc.c
parent3dbe219758f5c9712a5c1935d85be1434cf0eee8 (diff)
BUILD : 1.7.17 (1185) BUGS : N/A NOTES : Encryption now offers the choice of none, old and md5 - the md5 module is nicely taken from irc-services and actaully works, yes, real md5, in anope, wow eh?
git-svn-id: svn://svn.anope.org/anope/trunk@1185 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@905 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/misc.c b/src/misc.c
index cf684870c..5a16bfa07 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -62,6 +62,27 @@ int tolower(char c)
/*************************************************************************/
/**
+ * Simple function to convert binary data to hex.
+ * Taken from hybrid-ircd ( http://ircd-hybrid.com/ )
+ */
+void binary_to_hex(unsigned char *bin, char *hex, int length)
+{
+ static const char trans[] = "0123456789ABCDEF";
+ int i;
+
+ for(i = 0; i < length; i++)
+ {
+ hex[i << 1] = trans[bin[i] >> 4];
+ hex[(i << 1) + 1] = trans[bin[i] & 0xf];
+ }
+
+ hex[i << 1] = '\0';
+}
+
+
+/*************************************************************************/
+
+/**
* strscpy: Copy at most len-1 characters from a string to a buffer, and
* add a null terminator after the last character copied.
* @param d Buffer to copy into