X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_md5.cpp;h=6cec05a18e1b48efff4f012904178fcf00c620fe;hb=63aa8d0d42f619c52d382bde3e6ba2e5e23b12ac;hp=558bd68b9a5bd59fbbde3408f0b55caa2ca505a9;hpb=4ab1c43c1eee708fc50a4808f714a731891b75e8;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index 558bd68b9..6cec05a18 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -21,12 +21,7 @@ */ -/* $ModDesc: Allows for MD5 encrypted oper passwords */ - #include "inspircd.h" -#ifdef HAS_STDINT -#include -#endif #include "modules/hash.h" /* The four core functions - F1 is optimized somewhat */ @@ -39,10 +34,6 @@ #define MD5STEP(f,w,x,y,z,in,s) \ (w += f(x,y,z) + in, w = (w<>(32-s)) + x) -#ifndef HAS_STDINT -typedef unsigned int uint32_t; -#endif - typedef uint32_t word32; /* NOT unsigned long. We don't support 16 bit platforms, anyway. */ typedef unsigned char byte; @@ -163,7 +154,7 @@ class MD5Provider : public HashProvider void MD5Transform(word32 buf[4], word32 const in[16]) { - register word32 a, b, c, d; + word32 a, b, c, d; a = buf[0]; b = buf[1]; @@ -253,29 +244,15 @@ class MD5Provider : public HashProvider MD5Final((unsigned char*)dest, &context); } - - void GenHash(const char* src, char* dest, const char* xtab, unsigned int* ikey, size_t srclen) - { - unsigned char bytes[16]; - - MyMD5((char*)bytes, (void*)src, srclen, ikey); - - for (int i = 0; i < 16; i++) - { - *dest++ = xtab[bytes[i] / 16]; - *dest++ = xtab[bytes[i] % 16]; - } - *dest++ = 0; - } public: - std::string sum(const std::string& data) + std::string GenerateRaw(const std::string& data) { char res[16]; MyMD5(res, (void*)data.data(), data.length(), NULL); return std::string(res, 16); } - MD5Provider(Module* parent) : HashProvider(parent, "hash/md5", 16, 64) {} + MD5Provider(Module* parent) : HashProvider(parent, "md5", 16, 64) {} }; class ModuleMD5 : public Module @@ -284,7 +261,6 @@ class ModuleMD5 : public Module public: ModuleMD5() : md5(this) { - ServerInstance->Modules->AddService(md5); } Version GetVersion() CXX11_OVERRIDE