s3: Use jenkins hash for str_checksum, fix bug 8010
authorVolker Lendecke <vl@samba.org>
Tue, 15 Mar 2011 08:30:22 +0000 (09:30 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 16 Mar 2011 00:15:41 +0000 (01:15 +0100)
From the bugreport:

I have a folder with ~90 photos: IMG_XXXX.JPG where XXXX is a four digit
number, almost consecutive (photos from camera for one day).
Current implementation gives about 30 different checksums for this set of
files.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Mar 16 01:15:41 CET 2011 on sn-devel-104

source3/lib/util.c

index 81d2a78d3ce9620d63cf79bbc1e4a5f4d1f4b392..b6128feaf6591f3fe6a434ab6484d144cd27bf5f 100644 (file)
@@ -1899,17 +1899,8 @@ const char *tab_depth(int level, int depth)
 
 int str_checksum(const char *s)
 {
-       int res = 0;
-       int c;
-       int i=0;
-
-       while(*s) {
-               c = *s;
-               res ^= (c << (i % 15)) ^ (c >> (15-(i%15)));
-               s++;
-               i++;
-       }
-       return(res);
+       TDB_DATA key = string_tdb_data(s);
+       return tdb_jenkins_hash(&key);
 }
 
 /*****************************************************************