diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-04 20:48:26 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-04 20:48:26 +0000 |
commit | a8c3938dbdc7de2ef9c209d8984d33d4a3233006 (patch) | |
tree | 916c4d58857be39e0127c841cf0ded31538968ba | |
parent | 5e8fc20355e139d4fd81ab1faad7e564e55fef29 (diff) |
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
-rw-r--r-- | src/modules/m_md5.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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) |