]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_md5.cpp
Remove current time parameter of the Timer constructor
[user/henk/code/inspircd.git] / src / modules / m_md5.cpp
index c6761926a56fd59f1fc7a2e306dbaf329d2a1f8d..ecf76d07cb8cd7ff06045d8a7e95ee2675fe2d9b 100644 (file)
@@ -1,24 +1,28 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2008 Pippijn van Steenhoven <pip88nl@gmail.com>
+ *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
  *
- * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* $ModDesc: Allows for MD5 encrypted oper passwords */
-/* $ModDep: m_hash.h */
 
 #include "inspircd.h"
-#ifdef HAS_STDINT
-#include <stdint.h>
-#endif
-#include "m_hash.h"
+#include "modules/hash.h"
 
 /* The four core functions - F1 is optimized somewhat */
 #define F1(x, y, z) (z ^ (x & (y ^ z)))
 #define MD5STEP(f,w,x,y,z,in,s) \
        (w += f(x,y,z) + in, w = (w<<s | 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;
 
@@ -149,7 +149,7 @@ class MD5Provider : public HashProvider
 
                byteSwap(ctx->buf, 4);
                memcpy(digest, ctx->buf, 16);
-               memset(ctx, 0, sizeof(ctx));
+               memset(ctx, 0, sizeof(*ctx));
        }
 
        void MD5Transform(word32 buf[4], word32 const in[16])
@@ -266,14 +266,7 @@ class MD5Provider : public HashProvider
                return std::string(res, 16);
        }
 
-       std::string sumIV(unsigned int* IV, const char* HexMap, const std::string &sdata)
-       {
-               char res[33];
-               GenHash(sdata.data(), res, HexMap, IV, sdata.length());
-               return res;
-       }
-
-       MD5Provider(Module* parent) : HashProvider(parent, "hash/md5") {}
+       MD5Provider(Module* parent) : HashProvider(parent, "hash/md5", 16, 64) {}
 };
 
 class ModuleMD5 : public Module
@@ -282,10 +275,9 @@ class ModuleMD5 : public Module
  public:
        ModuleMD5() : md5(this)
        {
-               ServerInstance->Modules->AddService(md5);
        }
 
-       Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Implements MD5 hashing",VF_VENDOR);
        }