From a8c3938dbdc7de2ef9c209d8984d33d4a3233006 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 4 Dec 2006 20:48:26 +0000 Subject: m_md5 works now. No docs yet, CODER BEWARE! (on the flip side, see m_opermd5 for how to use it in the BASIC sense... it can do much more than this like take different IV's or change the binary-to-hex table (m_cloaking uses this stuff)) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5850 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_md5.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index 419d66e28..2500e6b36 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -25,9 +25,10 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" - #include "inspircd.h" +#include "m_md5.h" + /* The four core functions - F1 is optimized somewhat */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) @@ -289,18 +290,19 @@ class ModuleMD5 : public Module virtual char* OnRequest(Request* request) { - if (strcmp("MD5_SETKEY", request->GetId()) == 0) + MD5Request* MD5 = (MD5Request*)request; + if (strcmp("MD5_KEY", request->GetId()) == 0) { - this->key = (unsigned int*)request->GetData(); + this->key = (unsigned int*)MD5->GetKeyData(); } - else if (strcmp("MD5_SETCHARS", request->GetId()) == 0) + else if (strcmp("MD5_HEX", request->GetId()) == 0) { - this->chars = (char*)request->GetData(); + this->chars = (char*)MD5->GetOutputs(); } else if (strcmp("MD5_SUM", request->GetId()) == 0) { static char data[MAXBUF]; - GenHash((const char*)request->GetData(), data, chars ? chars : "0123456789abcdef", key); + GenHash((const char*)MD5->GetHashData(), data, chars ? chars : "0123456789abcdef", key); return data; } else if (strcmp("MD5_RESET", request->GetId()) == 0) -- cgit v1.2.3