X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Finspstring.cpp;h=816e37a19648027ac619734049e8869b796e1eb9;hb=bf0dd0513e016abb4025748fe12e57539078c70b;hp=f11ea1248b218fe3a4157957878bbad12fcf2496;hpb=b6dbd6caab62bc2c0d11ce5a45d511611eb9c2ef;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/inspstring.cpp b/src/inspstring.cpp index f11ea1248..816e37a19 100644 --- a/src/inspstring.cpp +++ b/src/inspstring.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * InspIRCd: (C) 2002-2010 InspIRCd Development Team * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see @@ -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; +}