| 220 | | unsigned char* t_hash; |
|---|
| 221 | | |
|---|
| 222 | | t_hash = g_malloc0(MD5_DIGEST_LENGTH + 1); |
|---|
| 223 | | |
|---|
| 224 | | md5(str, strlen(str), t_hash); |
|---|
| 225 | | return t_hash; |
|---|
| | 220 | unsigned char* hash; |
|---|
| | 221 | GString *hash_printable; |
|---|
| | 222 | int i; |
|---|
| | 223 | |
|---|
| | 224 | hash = g_malloc0(MD5_DIGEST_LENGTH + 1); |
|---|
| | 225 | |
|---|
| | 226 | md5(str, strlen(str), hash); |
|---|
| | 227 | |
|---|
| | 228 | hash_printable = g_string_sized_new((MD5_DIGEST_LENGTH * 2) + 1); |
|---|
| | 229 | for(i=0; i<MD5_DIGEST_LENGTH; i++) |
|---|
| | 230 | g_string_append_printf(hash_printable, "%02x", hash[i]); |
|---|
| | 231 | |
|---|
| | 232 | char *hash_str = hash_printable->str; |
|---|
| | 233 | g_string_free(hash_printable, FALSE); |
|---|
| | 234 | g_free(hash); |
|---|
| | 235 | return hash_str; |
|---|