]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_hash.h
Add snomask +s +L - remote link notices.
[user/henk/code/inspircd.git] / src / modules / m_hash.h
index 0c9eecdca40f6b8e9741a8d7091a5769ff7bc7c5..5686169dd2c514dd26bdf3373d3b612bd8ec01cf 100644 (file)
@@ -2,12 +2,9 @@
  *       | 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-2008 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.
  *
@@ -37,7 +34,7 @@ class HashRequest : public Request
        std::string tohash;
  public:
        /** Initialize HashRequest as an Hash_RESET message */
-       HashRequest(Module* Me, Module* Target) : Request(Me, Target, "RESET")
+       HashRequest(const char* req, Module* Me, Module* Target) : Request(Me, Target, req)
        {
        }
 
@@ -57,9 +54,9 @@ class HashRequest : public Request
        }
 
        /** Get data to be hashed */
-       const char* GetHashData()
+       std::string& GetHashData()
        {
-               return tohash.c_str();
+               return tohash;
        }
 
        /** Get keys (IVs) to be used */
@@ -75,7 +72,26 @@ class HashRequest : public Request
        }
 };
 
-/** Send this class to hashing.so to reset the Hash module to a known state.
+/** Send this class to the hashing module to query for its name.
+ *
+ * Example:
+ * \code
+ * cout << "Using hash algorithm: " << HashNameRequest(this, HashModule).Send();
+ * \endcode
+ */
+class HashNameRequest : public HashRequest
+{
+ public:
+       /** Initialize HashNameRequest for sending.
+        * @param Me A pointer to the sending module
+        * @param Target A pointer to the hashing module
+        */
+       HashNameRequest(Module* Me, Module* Target) : HashRequest("NAME", Me, Target)
+       {
+       }
+};
+
+/** Send this class to the hashing module to reset the Hash module to a known state.
  * This will reset the IV to the defaults specified by the Hash spec,
  * and reset the hex sequence to "0123456789abcdef". It should be sent before
  * ANY other Request types.
@@ -91,14 +107,14 @@ class HashResetRequest : public HashRequest
  public:
        /** Initialize HashResetRequest for sending.
         * @param Me A pointer to the sending module
-        * @param Target A pointer to the hashing.so module
+        * @param Target A pointer to the hashing module
         */
-       HashResetRequest(Module* Me, Module* Target) : HashRequest(Me, Target)
+       HashResetRequest(Module* Me, Module* Target) : HashRequest("RESET", Me, Target)
        {
        }
 };
 
-/** Send this class to hashing.so to HashSUM a std::string.
+/** Send this class to the hashing module to HashSUM a std::string.
  * You should make sure you know the state of the module before you send this
  * class, e.g. by first sending an HashResetRequest class. The hash will be
  * returned when you call Send().
@@ -116,15 +132,15 @@ class HashSumRequest : public HashRequest
  public:
        /** Initialize HashSumRequest for sending.
         * @param Me A pointer to the sending module
-        * @param Target A pointer to the hashing.so module
+        * @param Target A pointer to the hashing module
         * @param data The data to be hashed
         */
-       HashSumRequest(Module* Me, Module* Target, const std::string &data) : HashRequest(Me, Target, data)
+       HashSumRequest(Module* Me, Module* Target, const std::string &sdata) : HashRequest(Me, Target, sdata)
        {
        }
 };
 
-/** Send this class to hashing.so to change the IVs (keys) to use for hashing.
+/** Send this class to hashing module to change the IVs (keys) to use for hashing.
  * You should make sure you know the state of the module before you send this
  * class, e.g. by first sending an HashResetRequest class. The default values for
  * the IV's are those specified in the Hash specification. Only in very special
@@ -141,16 +157,16 @@ class HashKeyRequest : public HashRequest
  public:
        /** Initialize HashKeyRequest for sending.
         * @param Me A pointer to the sending module
-        * @param Target A pointer to the hashing.so module
+        * @param Target A pointer to the hashing module
         * @param data The new IV's. This should be an array of exactly four 32 bit values.
         * On 64-bit architectures, the upper 32 bits of the values will be discarded.
         */
-       HashKeyRequest(Module* Me, Module* Target, unsigned int* data) : HashRequest(Me, Target, data)
+       HashKeyRequest(Module* Me, Module* Target, unsigned int* sdata) : HashRequest(Me, Target, sdata)
        {
        }
 };
 
-/** Send this class to hashing.so to change the hex sequence to use for generating the returned value.
+/** Send this class to the hashing module to change the hex sequence to use for generating the returned value.
  * You should make sure you know the state of the module before you send this
  * class, e.g. by first sending an HashResetRequest class. The default value for
  * the hex sequence is "0123456789abcdef". Only in very special circumstances should
@@ -167,11 +183,11 @@ class HashHexRequest : public HashRequest
  public:
        /** Initialize HashHexRequest for sending.
         * @param Me A pointer to the sending module
-        * @param Target A pointer to the hashing.so module
+        * @param Target A pointer to the hashing module
         * @param data The hex sequence to use. This should contain exactly 16 ASCII characters,
         * terminated by a NULL char.
         */
-       HashHexRequest(Module* Me, Module* Target, const char* data) : HashRequest(Me, Target, data)
+       HashHexRequest(Module* Me, Module* Target, const char* sdata) : HashRequest(Me, Target, sdata)
        {
        }
 };