Codechange: make md5sumToString std::string compatible

This commit is contained in:
Rubidium
2023-04-27 22:18:53 +02:00
committed by rubidium42
parent 51c6b8c1e4
commit a312a6c1b2
12 changed files with 24 additions and 54 deletions

View File

@@ -612,20 +612,12 @@ int CDECL seprintf(char *str, const char *last, const char *format, ...)
/**
* Convert the md5sum to a hexadecimal string representation
* @param buf buffer to put the md5sum into
* @param last last character of buffer (usually lastof(buf))
* @param md5sum the md5sum itself
* @return a pointer to the next character after the md5sum
* @return the string representation of the md5sum.
*/
char *md5sumToString(char *buf, const char *last, const uint8 md5sum[16])
std::string MD5SumToString(const uint8 md5sum[16])
{
char *p = buf;
for (uint i = 0; i < 16; i++) {
p += seprintf(p, last, "%02X", md5sum[i]);
}
return p;
return FormatArrayAsHex({md5sum, 16});
}