Code cosmetics: Clean up MD5 hexdigest

The null terminator is not necessary when using this form of the
std::string constructor, and its use was confusing given the extra
indent.
This commit is contained in:
Robert Paprocki 2018-05-01 14:11:57 -07:00 committed by Felipe Zimmerle
parent d0b423fdd7
commit cd1a058c33
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -13,10 +13,10 @@ std::string Md5::hexdigest(std::string& input) {
mbedtls_md5(reinterpret_cast<const unsigned char *>(input.c_str()),
input.size(), digest);
char buf[33];
for (int i=0; i<16; i++)
char buf[32];
for (int i = 0; i < 16; i++) {
sprintf(buf+i*2, "%02x", digest[i]);
buf[32]=0;
}
return std::string(buf, 32);
}