X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Finspstring.cpp;h=816e37a19648027ac619734049e8869b796e1eb9;hb=bf0dd0513e016abb4025748fe12e57539078c70b;hp=b4c581f940305c0997cf928bbf096e62e4eb9e5a;hpb=f209cce90b394acd26e22eacef0bff61e8f5b4e1;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/inspstring.cpp b/src/inspstring.cpp index b4c581f94..816e37a19 100644 --- a/src/inspstring.cpp +++ b/src/inspstring.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2010 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -13,7 +13,7 @@ /* $Core */ -#include "inspstring.h" +#include "inspircd.h" /* * Copyright (c) 1998 Todd C. Miller @@ -136,3 +136,19 @@ CoreExport bool charremove(char* mp, char remove) return shift_down; } + +static const char hextable[] = "0123456789abcdef"; + +std::string BinToHex(const std::string& data) +{ + int l = data.length(); + std::string rv; + rv.reserve(l * 2); + for(int i=0; i < l; i++) + { + unsigned char c = data[i]; + rv.append(1, hextable[c >> 4]); + rv.append(1, hextable[c & 0xF]); + } + return rv; +}