blob: b4a1bd844fc8168e03d64c130e46161b26dafe4f [file] [log] [blame]
Jeff Thompsona8d7b062013-08-08 15:56:35 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
6#include <sstream>
7#include "common.hpp"
8
9using namespace std;
10
11namespace ndn {
12
Jeff Thompson1656e6a2013-08-29 18:01:48 -070013string toHex(const vector<unsigned char>& array)
Jeff Thompsona8d7b062013-08-08 15:56:35 -070014{
15 ostringstream result;
16 result.flags(ios::hex | ios::uppercase);
17 for (unsigned int i = 0; i < array.size(); ++i) {
18 unsigned char x = array[i];
19 if (x < 16)
20 result << '0';
21 result << (unsigned int)x;
22 }
23
24 return result.str();
25}
26
27}
28