now secure channel enabled
This commit is contained in:
@@ -30,8 +30,16 @@ namespace crypto {
|
||||
static const std::string VALID_CHARS
|
||||
(LETTER_CHARS+NUMBER_CHARS+GRAFIC_CHARS+BLANK_CHARS);
|
||||
|
||||
inline std::string hex(const std::string& data,
|
||||
std::string::size_type len=20) {
|
||||
inline std::string hex(const std::string& data) {
|
||||
std::stringstream res;
|
||||
for (std::string::const_iterator it(data.begin()); it!=data.end(); ++it)
|
||||
res<<std::hex<<std::setfill('0')<<std::setw(2)
|
||||
<<(unsigned int)(unsigned char)*it;
|
||||
return res.str();
|
||||
}
|
||||
|
||||
inline std::string hexTxt(const std::string& data,
|
||||
std::string::size_type len=20) {
|
||||
std::stringstream res;
|
||||
std::string::size_type pos(0);
|
||||
for (std::string::const_iterator it(data.begin()); it!=data.end(); ++it) {
|
||||
@@ -53,7 +61,7 @@ namespace crypto {
|
||||
if (!data.size())
|
||||
return "<empty>";
|
||||
else if (data.find_first_not_of(VALID_CHARS)<data.size())
|
||||
return hex(data);
|
||||
return hexTxt(data);
|
||||
else
|
||||
return "\""+data+"\"";
|
||||
}
|
||||
|
Reference in New Issue
Block a user