* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
- *
- * Written by Craig Edwards, Craig McLure, and others.
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
* This program is free but copyrighted software; see
* the file COPYING for details.
*
/* $ModDesc: Allows for MD5 encrypted oper passwords */
/* $ModDep: m_hash.h */
-using namespace std;
-
-#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 */
/* 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;
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)
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;
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 */
public:
ModuleMD5(InspIRCd* Me)
- : Module::Module(Me), key(NULL), chars(NULL)
+ : Module(Me), key(NULL), chars(NULL)
{
ServerInstance->PublishInterface("HashRequest", this);
}
virtual char* OnRequest(Request* request)
{
HashRequest* MD5 = (HashRequest*)request;
- ServerInstance->Log(DEBUG,"MD5 REQUEST type %s", request->GetId());
+
if (strcmp("KEY", request->GetId()) == 0)
{
this->key = (unsigned int*)MD5->GetKeyData();
}
else if (strcmp("SUM", request->GetId()) == 0)
{
- ServerInstance->Log(DEBUG,"MD5 SUM!");
static char data[MAXBUF];
GenHash((const char*)MD5->GetHashData(), data, chars ? chars : "0123456789abcdef", key);
return data;
}
else if (strcmp("RESET", request->GetId()) == 0)
{
- ServerInstance->Log(DEBUG,"MD5 RESET!");
this->chars = NULL;
this->key = NULL;
}
virtual Version GetVersion()
{
- return Version(1,1,0,1,VF_VENDOR,API_VERSION);
+ return Version(1,1,0,1,VF_VENDOR|VF_SERVICEPROVIDER,API_VERSION);
}
};
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleMD5Factory;
}