diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index a62db15285bbd34d535eed1dbd4daac59cd8eafd..84653bbe2fdb86e48d93c8af678d56ea3ec1142a 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2001-08-16  Richard Henderson  <rth@redhat.com>
+
+	* hashtab.c (htab_hash_string): New.
+
 2001-08-13  Andrew Cagney  <ac131313@redhat.com>
 
 	* floatformat.c (floatformat_ieee_double_littlebyte_bigword): Fix
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 274ad9ec2076d8d63fb845f1b0511310f2bcb941..28078027fef18ad75c109b8ba69f7e28328ff3f9 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -561,3 +561,19 @@ htab_collisions (htab)
 
   return (double) htab->collisions / (double) htab->searches;
 }
+
+/* Hash P as a null-terminated string.  */
+
+hashval_t
+htab_hash_string (p)
+     const PTR p;
+{
+  const unsigned char *str = (const unsigned char *) p;
+  hashval_t r = 0;
+  unsigned char c;
+
+  while ((c = *str++) != 0)
+    r = r * 67 + c - 113;
+
+  return r;
+}