(svn r8093) -Codechange: Add a function to get a string representation of an MD5SUM and use it.

This commit is contained in:
Darkvater
2007-01-13 13:47:57 +00:00
parent f2e5e604fb
commit 5ed33e549e
4 changed files with 23 additions and 11 deletions

View File

@@ -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 */