# HG changeset patch # User Mark Doliner # Date 1214080094 0 # Node ID 540a26a1a88d586a012f73e3521365ff9b33f19e # Parent 76f7e2186c3805d889c63a9be138bf3927a1a348 Helper functions are cool diff -r 76f7e2186c38 -r 540a26a1a88d libpurple/protocols/oscar/family_auth.c --- a/libpurple/protocols/oscar/family_auth.c Sat Jun 21 16:32:51 2008 +0000 +++ b/libpurple/protocols/oscar/family_auth.c Sat Jun 21 20:28:14 2008 +0000 @@ -81,12 +81,9 @@ static int aim_encode_password_md5(const char *password, size_t password_len, const char *key, guint8 *digest) { - PurpleCipher *cipher; PurpleCipherContext *context; - cipher = purple_ciphers_find_cipher("md5"); - - context = purple_cipher_context_new(cipher, NULL); + context = purple_cipher_context_new_by_name("md5", NULL); purple_cipher_context_append(context, (const guchar *)key, strlen(key)); purple_cipher_context_append(context, (const guchar *)password, password_len); purple_cipher_context_append(context, (const guchar *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); diff -r 76f7e2186c38 -r 540a26a1a88d libpurple/protocols/oscar/family_oservice.c --- a/libpurple/protocols/oscar/family_oservice.c Sat Jun 21 16:32:51 2008 +0000 +++ b/libpurple/protocols/oscar/family_oservice.c Sat Jun 21 20:28:14 2008 +0000 @@ -952,13 +952,10 @@ byte_stream_putraw(&bs, buf, 0x10); } else if (buf && (len > 0)) { /* use input buffer */ - PurpleCipher *cipher; PurpleCipherContext *context; guchar digest[16]; - cipher = purple_ciphers_find_cipher("md5"); - - context = purple_cipher_context_new(cipher, NULL); + context = purple_cipher_context_new_by_name("md5", NULL); purple_cipher_context_append(context, buf, len); purple_cipher_context_digest(context, 16, digest, NULL); purple_cipher_context_destroy(context); @@ -966,7 +963,6 @@ byte_stream_putraw(&bs, digest, 0x10); } else if (len == 0) { /* no length, just hash NULL (buf is optional) */ - PurpleCipher *cipher; PurpleCipherContext *context; guchar digest[16]; guint8 nil = '\0'; @@ -975,9 +971,7 @@ * I'm not sure if we really need the empty append with the * new MD5 functions, so I'll leave it in, just in case. */ - cipher = purple_ciphers_find_cipher("md5"); - - context = purple_cipher_context_new(cipher, NULL); + context = purple_cipher_context_new_by_name("md5", NULL); purple_cipher_context_append(context, &nil, 0); purple_cipher_context_digest(context, 16, digest, NULL); purple_cipher_context_destroy(context); diff -r 76f7e2186c38 -r 540a26a1a88d libpurple/protocols/oscar/oscar.c --- a/libpurple/protocols/oscar/oscar.c Sat Jun 21 16:32:51 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sat Jun 21 20:28:14 2008 +0000 @@ -6424,15 +6424,12 @@ if (img == NULL) { aim_ssi_delicon(od); } else { - PurpleCipher *cipher; PurpleCipherContext *context; guchar md5[16]; gconstpointer data = purple_imgstore_get_data(img); size_t len = purple_imgstore_get_size(img); - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); + context = purple_cipher_context_new_by_name("md5", NULL); purple_cipher_context_append(context, data, len); purple_cipher_context_digest(context, 16, md5, NULL); purple_cipher_context_destroy(context);