summaryrefslogtreecommitdiff
path: root/src/modules/m_hash.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-21 17:08:45 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-21 17:08:45 +0000
commitf91a61fa22b239384c31526fd11da1e3030aaa96 (patch)
tree1faad7b868d6485073f38e9c5104f16f1084bfe4 /src/modules/m_hash.h
parent4b2784862e7879b22f694801a25c4b2bedb457f9 (diff)
Add Base64 encode/decode functions to the core
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12507 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_hash.h')
-rw-r--r--src/modules/m_hash.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modules/m_hash.h b/src/modules/m_hash.h
index 7deb4c68c..edc9688b8 100644
--- a/src/modules/m_hash.h
+++ b/src/modules/m_hash.h
@@ -29,18 +29,21 @@ class HashProvider : public DataProvider
return BinToHex(sum(data));
}
+ inline std::string b64sum(const std::string& data)
+ {
+ return BinToBase64(sum(data), NULL, 0);
+ }
+
/** Allows the IVs for the hash to be specified. As the choice of initial IV is
* important for the security of a hash, this should not be used except to
* maintain backwards compatability. This also allows you to change the hex
* sequence from its default of "0123456789abcdef", which does not improve the
* strength of the output, but helps confuse those attempting to implement it.
*
- * Only m_md5 implements this request; only m_cloaking should use it.
- *
* Example:
* \code
* unsigned int iv[] = { 0xFFFFFFFF, 0x00000000, 0xAAAAAAAA, 0xCCCCCCCC };
- * std::string result = Hash.sumIV(iv, "0123456789abcdef", "data");
+ * std::string result = Hash.sumIV(iv, "fedcba9876543210", "data");
* \endcode
*/
virtual std::string sumIV(unsigned int* IV, const char* HexMap, const std::string &sdata) = 0;