Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c	(revision 246b98bbdf221448fd7a638fea04373ed1612de5)
+++ protocols/jabber/jabber.c	(revision 82149f422749a5ac7244c656d9baf25e52541d17)
@@ -33,5 +33,4 @@
 #include "jabber.h"
 #include "oauth.h"
-#include "md5.h"
 
 GSList *jabber_connections;
@@ -301,18 +300,18 @@
 }
 
-/* This generates an unfinished md5_state_t variable. Every time we generate
+/* This generates an unfinished g_checksum variable. Every time we generate
    an ID, we finish the state by adding a sequence number and take the hash. */
 static void jabber_generate_id_hash(struct jabber_data *jd)
 {
-	md5_byte_t binbuf[4];
+	guint8 binbuf[4];
 	char *s;
 
-	md5_init(&jd->cached_id_prefix);
-	md5_append(&jd->cached_id_prefix, (unsigned char *) jd->username, strlen(jd->username));
-	md5_append(&jd->cached_id_prefix, (unsigned char *) jd->server, strlen(jd->server));
+	jd->cached_id_prefix = g_checksum_new(G_CHECKSUM_MD5);
+	g_checksum_update(jd->cached_id_prefix, jd->username, strlen(jd->username));
+	g_checksum_update(jd->cached_id_prefix, jd->server, strlen(jd->server));
 	s = set_getstr(&jd->ic->acc->set, "resource");
-	md5_append(&jd->cached_id_prefix, (unsigned char *) s, strlen(s));
+	g_checksum_update(jd->cached_id_prefix, s, strlen(s));
 	random_bytes(binbuf, 4);
-	md5_append(&jd->cached_id_prefix, binbuf, 4);
+	g_checksum_update(jd->cached_id_prefix, binbuf, 4);
 }
 
@@ -371,5 +370,5 @@
 	xt_free(jd->xt);
 
-	md5_free(&jd->cached_id_prefix);
+	g_checksum_free(jd->cached_id_prefix);
 
 	g_free(jd->oauth2_access_token);
Index: protocols/jabber/jabber.h
===================================================================
--- protocols/jabber/jabber.h	(revision 246b98bbdf221448fd7a638fea04373ed1612de5)
+++ protocols/jabber/jabber.h	(revision 82149f422749a5ac7244c656d9baf25e52541d17)
@@ -28,5 +28,4 @@
 
 #include "bitlbee.h"
-#include "md5.h"
 #include "xmltree.h"
 
@@ -105,5 +104,5 @@
 	char *gmail_tid;
 
-	md5_state_t cached_id_prefix;
+	GChecksum *cached_id_prefix;
 	GHashTable *node_cache;
 	GHashTable *buddies;
Index: protocols/jabber/jabber_util.c
===================================================================
--- protocols/jabber/jabber_util.c	(revision 246b98bbdf221448fd7a638fea04373ed1612de5)
+++ protocols/jabber/jabber_util.c	(revision 82149f422749a5ac7244c656d9baf25e52541d17)
@@ -23,5 +23,4 @@
 
 #include "jabber.h"
-#include "md5.h"
 #include "base64.h"
 
@@ -141,6 +140,7 @@
 	struct jabber_data *jd = ic->proto_data;
 	struct jabber_cache_entry *entry = g_new0(struct jabber_cache_entry, 1);
-	md5_state_t id_hash;
-	md5_byte_t id_sum[16];
+	GChecksum *id_hash;
+	gsize digest_len = MD5_HASH_SIZE;
+	guint8 id_sum[MD5_HASH_SIZE];
 	char *id, *asc_hash;
 
@@ -148,6 +148,8 @@
 
 	id_hash = jd->cached_id_prefix;
-	md5_append(&id_hash, (md5_byte_t *) &next_id, sizeof(next_id));
-	md5_digest_keep(&id_hash, id_sum);
+	g_checksum_update(id_hash, (guint8 *) &next_id, sizeof(next_id));
+	g_checksum_get_digest(id_hash, id_sum, &digest_len);
+	g_checksum_free(id_hash);
+
 	asc_hash = base64_encode(id_sum, 12);
 
Index: protocols/jabber/sasl.c
===================================================================
--- protocols/jabber/sasl.c	(revision 246b98bbdf221448fd7a638fea04373ed1612de5)
+++ protocols/jabber/sasl.c	(revision 82149f422749a5ac7244c656d9baf25e52541d17)
@@ -302,6 +302,7 @@
 	if (!(s = sasl_get_part(dec, "rspauth"))) {
 		/* See RFC 2831 for for information. */
-		md5_state_t A1, A2, H;
-		md5_byte_t A1r[16], A2r[16], Hr[16];
+		GChecksum *A1, *A2, *H;
+		gsize digest_len = MD5_HASH_SIZE;
+		guint8 A1r[16], A2r[16], Hr[16];
 		char A1h[33], A2h[33], Hh[33];
 		int i;
@@ -327,17 +328,20 @@
 		/* Generate the MD5 hash of username:realm:password,
 		   I decided to call it H. */
-		md5_init(&H);
+		H = g_checksum_new(G_CHECKSUM_MD5);
 		s = g_strdup_printf("%s:%s:%s", jd->username, realm, ic->acc->pass);
-		md5_append(&H, (unsigned char *) s, strlen(s));
+		g_checksum_update(H, (guint8 *)s, strlen(s));
 		g_free(s);
-		md5_finish(&H, Hr);
+
+		g_checksum_get_digest(H, Hr, &digest_len);
+		g_checksum_free(H);
 
 		/* Now generate the hex. MD5 hash of H:nonce:cnonce, called A1. */
-		md5_init(&A1);
+		A1 = g_checksum_new(G_CHECKSUM_MD5);
 		s = g_strdup_printf(":%s:%s", nonce, cnonce);
-		md5_append(&A1, Hr, 16);
-		md5_append(&A1, (unsigned char *) s, strlen(s));
+		g_checksum_update(A1, Hr, 16);
+		g_checksum_update(A1, (guint8 *)s, strlen(s));
 		g_free(s);
-		md5_finish(&A1, A1r);
+		g_checksum_get_digest(A1, A1r, &digest_len);
+		g_checksum_free(A1);
 		for (i = 0; i < 16; i++) {
 			sprintf(A1h + i * 2, "%02x", A1r[i]);
@@ -345,9 +349,10 @@
 
 		/* A2... */
-		md5_init(&A2);
+		A2 = g_checksum_new(G_CHECKSUM_MD5);
 		s = g_strdup_printf("%s:%s", "AUTHENTICATE", digest_uri);
-		md5_append(&A2, (unsigned char *) s, strlen(s));
+		g_checksum_update(A2, (guint8 *)s, strlen(s));
 		g_free(s);
-		md5_finish(&A2, A2r);
+		g_checksum_get_digest(A2, A2r, &digest_len);
+		g_checksum_free(A2);
 		for (i = 0; i < 16; i++) {
 			sprintf(A2h + i * 2, "%02x", A2r[i]);
@@ -355,9 +360,11 @@
 
 		/* Final result: A1:nonce:00000001:cnonce:auth:A2. Let's reuse H for it. */
-		md5_init(&H);
+		H = g_checksum_new(G_CHECKSUM_MD5);
 		s = g_strdup_printf("%s:%s:%s:%s:%s:%s", A1h, nonce, "00000001", cnonce, "auth", A2h);
-		md5_append(&H, (unsigned char *) s, strlen(s));
+		g_checksum_update(H, (guint8 *)s, strlen(s));
 		g_free(s);
-		md5_finish(&H, Hr);
+		g_checksum_get_digest(H, Hr, &digest_len);
+		g_checksum_free(H);
+
 		for (i = 0; i < 16; i++) {
 			sprintf(Hh + i * 2, "%02x", Hr[i]);
