diff options
Diffstat (limited to 'src/lib/libcrypto/lhash/lhash.c')
-rw-r--r-- | src/lib/libcrypto/lhash/lhash.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/lib/libcrypto/lhash/lhash.c b/src/lib/libcrypto/lhash/lhash.c index 6a340a2403..7eb92a18bc 100644 --- a/src/lib/libcrypto/lhash/lhash.c +++ b/src/lib/libcrypto/lhash/lhash.c | |||
@@ -159,7 +159,7 @@ void lh_free(LHASH *lh) | |||
159 | unsigned int i; | 159 | unsigned int i; |
160 | LHASH_NODE *n,*nn; | 160 | LHASH_NODE *n,*nn; |
161 | 161 | ||
162 | if(lh == NULL) | 162 | if (lh == NULL) |
163 | return; | 163 | return; |
164 | 164 | ||
165 | for (i=0; i<lh->num_nodes; i++) | 165 | for (i=0; i<lh->num_nodes; i++) |
@@ -422,21 +422,6 @@ static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash) | |||
422 | return(ret); | 422 | return(ret); |
423 | } | 423 | } |
424 | 424 | ||
425 | /* | ||
426 | unsigned long lh_strhash(char *str) | ||
427 | { | ||
428 | int i,l; | ||
429 | unsigned long ret=0; | ||
430 | unsigned short *s; | ||
431 | |||
432 | if (str == NULL) return(0); | ||
433 | l=(strlen(str)+1)/2; | ||
434 | s=(unsigned short *)str; | ||
435 | for (i=0; i<l; i++) | ||
436 | ret^=(s[i]<<(i&0x0f)); | ||
437 | return(ret); | ||
438 | } */ | ||
439 | |||
440 | /* The following hash seems to work very well on normal text strings | 425 | /* The following hash seems to work very well on normal text strings |
441 | * no collisions on /usr/dict/words and it distributes on %2^n quite | 426 | * no collisions on /usr/dict/words and it distributes on %2^n quite |
442 | * well, not as good as MD5, but still good. | 427 | * well, not as good as MD5, but still good. |
@@ -470,3 +455,7 @@ unsigned long lh_strhash(const char *c) | |||
470 | return((ret>>16)^ret); | 455 | return((ret>>16)^ret); |
471 | } | 456 | } |
472 | 457 | ||
458 | unsigned long lh_num_items(LHASH *lh) | ||
459 | { | ||
460 | return lh ? lh->num_items : 0; | ||
461 | } | ||