summaryrefslogtreecommitdiff
path: root/src/misc.cpp
diff options
context:
space:
mode:
authorNaram Qashat <cyberbotx@cyberbotx.com>2010-08-01 12:21:42 -0400
committerNaram Qashat <cyberbotx@cyberbotx.com>2010-08-01 12:21:42 -0400
commit084766069cdf24b69e1f146db4d44a24b617e7de (patch)
treec1ff0fd43ed68a7ee55d4ad953dc45bc8310362b /src/misc.cpp
parent1175ef320e25919746cafda6c8aaa57c5adc1860 (diff)
parentbfd94136c62b20f0a8e15d22815ef3a6e6438d49 (diff)
Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Diffstat (limited to 'src/misc.cpp')
-rw-r--r--src/misc.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/misc.cpp b/src/misc.cpp
index e24301d44..cac6b8b08 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -1296,3 +1296,26 @@ bool str_is_cidr(const Anope::string &str, uint32 &ip, uint32 &mask, Anope::stri
return true;
}
+
+/********************************************************************************/
+
+/** Converts a string to hex
+ * @param the data to be converted
+ * @return a anope::string containing the hex value
+ */
+
+Anope::string Anope::Hex(const Anope::string &data)
+{
+ const char hextable[] = "0123456789abcdef";
+
+ int l = data.length();
+ Anope::string rv;
+ for(int i=0; i < l; i++)
+ {
+ unsigned char c = data[i];
+ rv += hextable[c >> 4];
+ rv += hextable[c & 0xF];
+ }
+ return rv;
+}
+