examples/third_party/openssl/openssl_test.cc
// Convert an byte array into a string
Convert an byte array into a string
Convert an byte array into a string
std::string fromByteArray(const unsigned char* data, unsigned long length)
{
    std::stringstream shastr;
    shastr << std::hex << std::setfill('0');
    for (unsigned long i = 0; i < length; ++i)
    {
        shastr << std::setw(2) << static_cast<int>(data[i]);
    }
    return shastr.str();
}
std :: string fromByteArray ( const unsigned char * data , unsigned long length ) { std :: stringstream shastr ; shastr << std :: hex << std :: setfill ( ' ' ) ; for ( unsigned long i = 0 ; i < length ; ++ i ) { shastr << std :: setw ( 2 ) << static_cast < int > ( data [ i ] ) ; } return shastr . str ( ) ; }
Convert an byte array into a string
Convert an byte array into a string