]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_md5.cpp
Convert more modules
[user/henk/code/inspircd.git] / src / modules / m_md5.cpp
index 4ed011acf853bb2a26af24344c61e41263db4cbb..ada92df8138894ce1955aff80e04876d19d2daf0 100644 (file)
 /* $ModDesc: Allows for MD5 encrypted oper passwords */
 /* $ModDep: m_hash.h */
 
-#include "inspircd_config.h"
+#include "inspircd.h"
 #ifdef HAS_STDINT
 #include <stdint.h>
 #endif
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
-#include "inspircd.h"
-
 #include "m_hash.h"
 
 /* The four core functions - F1 is optimized somewhat */
@@ -33,7 +31,7 @@
 
 /* This is the central step in the MD5 algorithm. */
 #define MD5STEP(f,w,x,y,z,in,s) \
-         (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
+       (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
 
 #ifndef HAS_STDINT
 typedef unsigned int uint32_t;
@@ -65,9 +63,8 @@ class ModuleMD5 : public Module
                        p += 4;
                } while (--words);
        }
-       
-       /* XXX - maybe if we had an md5/encryption moduletype? *shrug* */
-       void MD5Init(struct MD5Context *ctx, unsigned int* key = NULL)
+
+       void MD5Init(MD5Context *ctx, unsigned int* key = NULL)
        {
                /* These are the defaults for md5 */
                if (!key)
@@ -89,7 +86,7 @@ class ModuleMD5 : public Module
                ctx->bytes[1] = 0;
        }
 
-       void MD5Update(struct MD5Context *ctx, byte const *buf, int len)
+       void MD5Update(MD5Context *ctx, byte const *buf, int len)
        {
                word32 t;
        
@@ -126,7 +123,7 @@ class ModuleMD5 : public Module
                memcpy(ctx->in, buf, len);
        }
        
-       void MD5Final(byte digest[16], struct MD5Context *ctx)
+       void MD5Final(byte digest[16], MD5Context *ctx)
        {
                int count = (int)(ctx->bytes[0] & 0x3f); /* Bytes in ctx->in */
                byte *p = (byte *)ctx->in + count;      /* First unused byte */
@@ -271,7 +268,7 @@ class ModuleMD5 : public Module
  public:
 
        ModuleMD5(InspIRCd* Me)
-               : Module::Module(Me), key(NULL), chars(NULL)
+               : Module(Me), key(NULL), chars(NULL)
        {
                ServerInstance->PublishInterface("HashRequest", this);
        }
@@ -342,7 +339,7 @@ class ModuleMD5Factory : public ModuleFactory
 };
 
 
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
 {
        return new ModuleMD5Factory;
 }