(svn r8093) -Codechange: Add a function to get a string representation of an MD5SUM and use it.
This commit is contained in:
@@ -177,6 +177,24 @@ int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
/** 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 */
|
||||
char *md5sumToString(char *buf, const char *last, const uint8 md5sum[16])
|
||||
{
|
||||
char *p = buf;
|
||||
|
||||
for (uint i = 0; i < 16; i++) {
|
||||
p += snprintf(p, last + 1 - p, "%02X", md5sum[i]);
|
||||
if (p >= last) break;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/* UTF-8 handling routines */
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user