Index: lib/sha1.c
===================================================================
--- lib/sha1.c	(revision 59c9fa4d3fa235d2f884e6c1a8110f9ef1d4bd25)
+++ lib/sha1.c	(revision a4ac9c413b97decae5adf15b69f4bbfdce0ef5e4)
@@ -100,6 +100,9 @@
 	char *ret = g_new0(char, 40);   /* 36 chars + \0 */
 	int i, p;
+	gsize digest_len = SHA1_HASH_SIZE;
 
-	sha1_finish(context, dig);
+	g_checksum_get_digest(*context, dig, &digest_len);
+	g_checksum_free(*context);
+
 	for (p = i = 0; i < 16; i++) {
 		if (i == 4 || i == 6 || i == 8 || i == 10) {
Index: lib/sha1.h
===================================================================
--- lib/sha1.h	(revision 59c9fa4d3fa235d2f884e6c1a8110f9ef1d4bd25)
+++ lib/sha1.h	(revision a4ac9c413b97decae5adf15b69f4bbfdce0ef5e4)
@@ -6,12 +6,18 @@
 #include <gmodule.h>
 
+#ifdef __GNUC__
+#define __SHA1_NON_PUBLIC_DEPRECATION__ __attribute__((deprecated("sha1.h will be removed from Bitlbee's public API. Please use another library (such as GLib's gchecksum) instead")))
+#else
+#define __SHA1_NON_PUBLIC_DEPRECATION__
+#endif
+
 #define SHA1_HASH_SIZE 20
 
 typedef GChecksum *sha1_state_t;
 
-void sha1_init(sha1_state_t *);
-void sha1_append(sha1_state_t *, const guint8 *, unsigned int);
-void sha1_finish(sha1_state_t *, guint8 digest[SHA1_HASH_SIZE]);
-void sha1_hmac(const char *, size_t, const char *, size_t, guint8 digest[SHA1_HASH_SIZE]);
+void sha1_init(sha1_state_t *) __SHA1_NON_PUBLIC_DEPRECATION__;
+void sha1_append(sha1_state_t *, const guint8 *, unsigned int) __SHA1_NON_PUBLIC_DEPRECATION__;
+void sha1_finish(sha1_state_t *, guint8 digest[SHA1_HASH_SIZE]) __SHA1_NON_PUBLIC_DEPRECATION__;
+void sha1_hmac(const char *, size_t, const char *, size_t, guint8 digest[SHA1_HASH_SIZE]) ;
 char *sha1_random_uuid(sha1_state_t *);
 
Index: protocols/jabber/conference.c
===================================================================
--- protocols/jabber/conference.c	(revision 59c9fa4d3fa235d2f884e6c1a8110f9ef1d4bd25)
+++ protocols/jabber/conference.c	(revision a4ac9c413b97decae5adf15b69f4bbfdce0ef5e4)
@@ -23,5 +23,4 @@
 
 #include "jabber.h"
-#include "sha1.h"
 
 static xt_status jabber_chat_join_failed(struct im_connection *ic, struct xt_node *node, struct xt_node *orig);
@@ -79,13 +78,13 @@
 	struct jabber_chat *jc;
 	struct groupchat *c;
-	sha1_state_t sum;
+	GChecksum *sum;
 	double now = gettime();
 	char *uuid, *rjid, *cserv;
 
-	sha1_init(&sum);
-	sha1_append(&sum, (uint8_t *) ic->acc->user, strlen(ic->acc->user));
-	sha1_append(&sum, (uint8_t *) &now, sizeof(now));
-	sha1_append(&sum, (uint8_t *) who, strlen(who));
-	uuid = sha1_random_uuid(&sum);
+	sum = g_checksum_new(G_CHECKSUM_SHA1);
+	g_checksum_update(sum, (uint8_t *) ic->acc->user, strlen(ic->acc->user));
+	g_checksum_update(sum, (uint8_t *) &now, sizeof(now));
+	g_checksum_update(sum, (uint8_t *) who, strlen(who));
+	uuid = sha1_random_uuid(sum);
 
 	if (jd->flags & JFLAG_GTALK) {
Index: protocols/jabber/iq.c
===================================================================
--- protocols/jabber/iq.c	(revision 59c9fa4d3fa235d2f884e6c1a8110f9ef1d4bd25)
+++ protocols/jabber/iq.c	(revision a4ac9c413b97decae5adf15b69f4bbfdce0ef5e4)
@@ -23,5 +23,4 @@
 
 #include "jabber.h"
-#include "sha1.h"
 
 static xt_status jabber_parse_roster(struct im_connection *ic, struct xt_node *node, struct xt_node *orig);
@@ -245,13 +244,15 @@
 		/* We can do digest authentication, it seems, and of
 		   course we prefer that. */
-		sha1_state_t sha;
+		GChecksum *sha;
 		char hash_hex[41];
 		unsigned char hash[20];
 		int i;
-
-		sha1_init(&sha);
-		sha1_append(&sha, (unsigned char *) s, strlen(s));
-		sha1_append(&sha, (unsigned char *) ic->acc->pass, strlen(ic->acc->pass));
-		sha1_finish(&sha, hash);
+		gsize digest_len = 20;
+
+		sha = g_checksum_new(G_CHECKSUM_SHA1);
+		g_checksum_update(sha, (unsigned char *) s, strlen(s));
+		g_checksum_update(sha, (unsigned char *) ic->acc->pass, strlen(ic->acc->pass));
+		g_checksum_get_digest(sha, hash, &digest_len);
+		g_checksum_free(sha);
 
 		for (i = 0; i < 20; i++) {
Index: protocols/jabber/si.c
===================================================================
--- protocols/jabber/si.c	(revision 59c9fa4d3fa235d2f884e6c1a8110f9ef1d4bd25)
+++ protocols/jabber/si.c	(revision a4ac9c413b97decae5adf15b69f4bbfdce0ef5e4)
@@ -23,5 +23,4 @@
 
 #include "jabber.h"
-#include "sha1.h"
 
 void jabber_si_answer_request(file_transfer_t *ft);
