Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 613 Bytes

mischelper.c

File metadata and controls

28 lines (23 loc) · 613 Bytes
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* \file mischelper.c
*
* Source file with miscellaneous helper functions.
*/
#include <SDL_test.h>
void
SDLVisualTest_HashString(char* str, char hash[33])
{
SDLTest_Md5Context md5c;
int i;
if(!str)
{
SDLTest_LogError("str argument cannot be NULL");
return;
}
SDLTest_Md5Init(&md5c);
SDLTest_Md5Update(&md5c, (unsigned char*)str, SDL_strlen(str));
SDLTest_Md5Final(&md5c);
/* convert the md5 hash to an array of hexadecimal digits */
for(i = 0; i < 16; i++)
SDL_snprintf(hash + 2 * i, 33 - 2 * i, "%02x", (int)md5c.digest[i]);
}