summaryrefslogtreecommitdiff
path: root/src/modules/m_opermd5.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_opermd5.cpp')
-rw-r--r--src/modules/m_opermd5.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp
index 1e085deae..57eb2c5ef 100644
--- a/src/modules/m_opermd5.cpp
+++ b/src/modules/m_opermd5.cpp
@@ -252,23 +252,17 @@ void MyMD5(void *dest, void *orig, int len)
void GenHash(const char* src, char* dest)
{
- int i = 0;
unsigned char bytes[16];
- char hash[1024];
- *hash = 0;
+ const char* xtab = "0123456789abcdef";
+
MyMD5((char*)bytes,(void*)src,strlen(src));
- for (i = 0; i < 16; i++)
+
+ for (int i = 0; i < 16; i++)
{
- const char* xtab = "0123456789abcdef";
- unsigned char lo = xtab[bytes[i] % 16];
- unsigned char hi = xtab[bytes[i] / 16];
- char hx[3];
- hx[0] = hi;
- hx[1] = lo;
- hx[2] = '\0';
- strcat(hash,hx);
+ *dest++ = xtab[bytes[i] % 16];
+ *dest++ = xtab[bytes[i] / 16];
}
- strcpy(dest,hash);
+ *dest++ = 0;
}
/** Handle /MKPASSWD