blob: b4c6e45e13e16ce8b7471aade3e52268d50da71a [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
13string toHex(const vector<unsigned char> &array)
14{
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