diff options
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r-- | src/hashcomp.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 88b9b582c..d3db02da4 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -275,3 +275,21 @@ const std::string irc::commasepstream::GetToken() irc::commasepstream::~commasepstream() { } + +std::string irc::hex(const unsigned char *raw, size_t rawsz) +{ + if (!rawsz) + return ""; + + char buf[rawsz*2+1]; + size_t i; + + for (i = 0; i < rawsz; i++) + { + sprintf (&(buf[i*2]), "%02x", raw[i]); + } + buf[i*2] = 0; + + return buf; +} + |