mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Change algo for connection_create_stanza_id()
This commit is contained in:
parent
8f5d1751b2
commit
827af999b7
@ -459,17 +459,21 @@ char*
|
|||||||
connection_create_stanza_id(char *prefix)
|
connection_create_stanza_id(char *prefix)
|
||||||
{
|
{
|
||||||
unsigned char *digest = (unsigned char*)malloc(XMPP_SHA1_DIGEST_SIZE);
|
unsigned char *digest = (unsigned char*)malloc(XMPP_SHA1_DIGEST_SIZE);
|
||||||
char *uuid = connection_create_uuid();
|
char *msgid = get_random_string(10);
|
||||||
|
|
||||||
assert(digest != NULL);
|
assert(digest != NULL);
|
||||||
assert(uuid != NULL);
|
assert(msgid != NULL);
|
||||||
|
|
||||||
GString *tmp = g_string_new("");
|
GString *signature = g_string_new("");
|
||||||
g_string_printf(tmp, "%s%s", prof_identifier, uuid);
|
g_string_printf(signature, "%s%s", prof_identifier, msgid);
|
||||||
xmpp_sha1_digest((unsigned char*)tmp->str, strlen(tmp->str), digest);
|
xmpp_sha1_digest((unsigned char*)signature->str, strlen(signature->str), digest);
|
||||||
g_string_free(tmp, TRUE);
|
g_string_free(signature, TRUE);
|
||||||
|
|
||||||
char *b64 = g_base64_encode(digest, XMPP_SHA1_DIGEST_SIZE);
|
GString *id = g_string_new("");
|
||||||
|
g_string_printf(id, "%s%s", digest, msgid);
|
||||||
|
|
||||||
|
char *b64 = g_base64_encode((unsigned char*)id->str, XMPP_SHA1_DIGEST_SIZE);
|
||||||
|
g_string_free(id, TRUE);
|
||||||
assert(b64 != NULL);
|
assert(b64 != NULL);
|
||||||
free(digest);
|
free(digest);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user