From cd1a058c33765461468a1d15cf56541d1008e495 Mon Sep 17 00:00:00 2001 From: Robert Paprocki Date: Tue, 1 May 2018 14:11:57 -0700 Subject: [PATCH] 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. --- src/utils/md5.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/md5.cc b/src/utils/md5.cc index 4c9a3247..1480dc0e 100644 --- a/src/utils/md5.cc +++ b/src/utils/md5.cc @@ -13,10 +13,10 @@ std::string Md5::hexdigest(std::string& input) { mbedtls_md5(reinterpret_cast(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); }