]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_opermd5.cpp
Tidyup
[user/henk/code/inspircd.git] / src / modules / m_opermd5.cpp
index 1e085deaec4774f642a799c978067f9bd15f1322..e4d494ffc667dbdcc3341c11348e461b03a1fb80 100644 (file)
@@ -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
@@ -331,7 +325,7 @@ class ModuleOperMD5 : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,0,0,1,VF_VENDOR);
+               return Version(1,1,0,1,VF_VENDOR,API_VERSION);
        }
 };