summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Gadu-Gadu/src')
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp6
2 files changed, 3 insertions, 11 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index 42685a821f..400182613c 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -109,18 +109,14 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
char *gg_avatarhash(char *param)
{
- mir_sha1_byte_t digest[MIR_SHA1_HASH_SIZE];
char *result;
- int i;
if (param == NULL || (result = (char *)mir_alloc(MIR_SHA1_HASH_SIZE * 2 + 1)) == NULL)
return NULL;
+ mir_sha1_byte_t digest[MIR_SHA1_HASH_SIZE];
mir_sha1_hash((BYTE*)param, (int)strlen(param), digest);
- for (i = 0; i < MIR_SHA1_HASH_SIZE; i++)
- mir_snprintf(result + (i<<1), 2, "%02x", digest[i]);
-
- return result;
+ return bin2hex(digest, sizeof(digest), result);
}
void GGPROTO::requestAvatarTransfer(HANDLE hContact, char *szAvatarURL)
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index 701b0508bc..e2484a3838 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -273,11 +273,7 @@ char *oauth_generate_nonce()
mir_md5_byte_t digest[16];
mir_md5_hash((BYTE*)(char*)str, (int)strlen(str), digest);
-
- char *result = (char *)mir_alloc(32 + 1);
- for (int i = 0; i < 16; i++)
- mir_snprintf(result + (i<<1), 2, "%02x", digest[i]);
- return result;
+ return bin2hex(digest, sizeof(digest), (char *)mir_alloc(32 + 1));
}
char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD signmethod,