X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffinger.c;h=b2e0460a87f96c0c5a18859f3aacbce757bda5ba;hb=c3e813db9bc5afffa8a573f060fd177bf2e18e26;hp=a9ce7b4905101a7fb343e957678bcd0948b15d36;hpb=61192ac10b2c1ee0f39f652a94c9a2d681ab2b6a;p=libucw.git diff --git a/lib/finger.c b/lib/finger.c index a9ce7b49..b2e0460a 100644 --- a/lib/finger.c +++ b/lib/finger.c @@ -1,7 +1,7 @@ /* * Sherlock Library -- String Fingerprints * - * (c) 2001--2002 Martin Mares + * (c) 2001--2003 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -18,46 +18,24 @@ * of our bit string universe (2^96) and c is a small constant. * We set m sufficiently large and expect no collisions * to occur. On the other hand, the worst thing which could - * be cause by a collision is mixing up two strings or labels + * be caused by a collision is mixing up two strings or labels * of two documents which is relatively harmless. */ #include "lib/lib.h" -#include "lib/conf.h" #include "lib/index.h" #include "lib/md5.h" #include -static uns finger_www_hack; - -static struct cfitem finger_config[] = { - { "Fingerprints", CT_SECTION, NULL }, - { "WWWHack", CT_INT, &finger_www_hack }, - { NULL, CT_STOP, NULL } -}; - -static void CONSTRUCTOR finger_conf_init(void) -{ - cf_register(finger_config); -} - void fingerprint(byte *string, struct fingerprint *fp) { struct MD5Context c; - uns len = strlen(string); byte digest[16]; MD5Init(&c); - if (finger_www_hack && len >= 11 && !memcmp(string, "http://www.", 11)) - { - /* FIXME: This is a dirty hack, but it has to stay until we get real handling of duplicates */ - MD5Update(&c, string, 7); - MD5Update(&c, string+11, len-11); - } - else - MD5Update(&c, string, len); + MD5Update(&c, string, strlen(string)); MD5Final(digest, &c); memcpy(fp->hash, digest, 12); }