summaryrefslogtreecommitdiff
path: root/sdbm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sdbm.c')
-rw-r--r--sdbm.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sdbm.c b/sdbm.c
new file mode 100644
index 0000000..8c97bd2
--- /dev/null
+++ b/sdbm.c
@@ -0,0 +1,10 @@
+#include "sdbm.h"
+
+unsigned long sdbm(char *str) {
+ unsigned long hash = 0;
+ int c;
+ while(c = *str++) {
+ hash = c + (hash << 6) + (hash << 16) - hash;
+ }
+ return hash;
+}