diff -ur gq-0.5.0/AUTHORS gq-0.5.0-ktg/AUTHORS
--- gq-0.5.0/AUTHORS	Sat Mar 25 08:40:23 2000
+++ gq-0.5.0-ktg/AUTHORS	Mon Apr 15 11:00:32 2002
@@ -1 +1,4 @@
 Bert Vermeulen <bert@biot.com>
+
+Keith Garner <kgarner@kgarner.com> - helped add openldap friendly md5 and sha
+Dave Dribin <dave@dribin.org> - helped add openldap friendly md5 and sha
diff -ur gq-0.5.0/src/encode.c gq-0.5.0-ktg/src/encode.c
--- gq-0.5.0/src/encode.c	Mon Mar 18 17:49:35 2002
+++ gq-0.5.0-ktg/src/encode.c	Mon Apr 15 11:14:37 2002
@@ -32,6 +32,9 @@
 #include <openssl/des.h>
 #include <openssl/md5.h>
 #include <openssl/sha.h>
+#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/buffer.h>
 #endif /* HAVE_LIBCRYPTO */
 
 #include <glib.h>
@@ -51,6 +54,11 @@
 #define LDAP_CODESET "UTF-8"
 #define GQ_CODESET "ISO-8859-1"
 
+#if defined(HAVE_LIBCRYPTO)
+static void base64_encode(char *dest, int dest_max_length, const char *src,
+						  int src_length);
+#endif
+
 extern struct tokenlist cryptmap[];
 
 
@@ -123,37 +131,63 @@
 
 }
 
-
 void encode_password_md5(struct formfill *form)
 {
-     int i;
-     unsigned char *password, password_out[64], md5_out[MD5_DIGEST_LENGTH];
+     unsigned char *password, password_out[64], tmp_pout[64], md5_out[MD5_DIGEST_LENGTH];
 
      password = form->values->data;
      MD5(password, strlen(password), md5_out);
      strcpy(password_out, "{md5}");
-     for(i = 0; i < MD5_DIGEST_LENGTH; i++)
-	  sprintf(password_out + strlen(password_out), "%.02x", md5_out[i]);
+	 base64_encode(tmp_pout, sizeof(tmp_pout), md5_out, sizeof(md5_out));
+	 strncat(password_out, tmp_pout, 58);
+
      g_free(form->values->data);
      form->values->data = g_strdup(password_out);
-
 }
 
 
+
 void encode_password_sha1(struct formfill *form)
 {
-     int i;
-     unsigned char *password, password_out[64], sha1_out[SHA_DIGEST_LENGTH];
+     unsigned char *password, password_out[64], tmp_pout[64], sha1_out[SHA_DIGEST_LENGTH];
 
      password = form->values->data;
      SHA1(password, strlen(password), sha1_out);
      strcpy(password_out, "{sha}");
-     for(i = 0; i < SHA_DIGEST_LENGTH; i++)
-	  sprintf(password_out + strlen(password_out), "%.02x", sha1_out[i]);
+	 base64_encode(tmp_pout, sizeof(tmp_pout), sha1_out, sizeof(sha1_out));
+	 strncat(password_out, tmp_pout, 58);
+
      g_free(form->values->data);
      form->values->data = g_strdup(password_out);
 
 }
+
+static void base64_encode(char *dest, int dest_max_length, const char *src,
+						  int src_length)
+{
+	 BIO *b64, *bio;
+	 BUF_MEM *mem;
+	 int copy_size;
+
+	 b64 = BIO_new(BIO_f_base64());
+	 BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+	 bio = BIO_new(BIO_s_mem());
+	 bio = BIO_push(b64, bio);
+	 BIO_write(bio, src, src_length);
+	 BIO_flush(bio);
+	 BIO_get_mem_ptr(bio, &mem);
+	 BIO_set_close(bio, BIO_NOCLOSE);
+	 BIO_free_all(bio);
+
+	 if (mem->length > dest_max_length)
+		 copy_size = dest_max_length - 1;
+	 else
+		 copy_size = mem->length;
+	 memcpy(dest, mem->data, copy_size);
+	 dest[copy_size] = '\0';
+
+	 BUF_MEM_free(mem);
+}
 #endif /* HAVE_LIBCRYPTO */
 
 
Only in gq-0.5.0-ktg/src: encode.c~
