diff options
| author | beck <> | 2000-04-15 06:18:51 +0000 |
|---|---|---|
| committer | beck <> | 2000-04-15 06:18:51 +0000 |
| commit | b608c7f2b175e121f2c22d53341a317153afdc8e (patch) | |
| tree | e94b160b3fcd8180df79e4251d68d24d665f0195 /src/lib/libcrypto/lhash | |
| parent | c8d6701c396cebdcd0d45eac73b762e9498f6b01 (diff) | |
| download | openbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.tar.gz openbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.tar.bz2 openbsd-b608c7f2b175e121f2c22d53341a317153afdc8e.zip | |
OpenSSL 0.9.5a merge
Diffstat (limited to 'src/lib/libcrypto/lhash')
| -rw-r--r-- | src/lib/libcrypto/lhash/lhash.c | 21 | ||||
| -rw-r--r-- | src/lib/libcrypto/lhash/lhash.h | 1 |
2 files changed, 6 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 | } | ||
diff --git a/src/lib/libcrypto/lhash/lhash.h b/src/lib/libcrypto/lhash/lhash.h index 6f6eeb2698..d315fd9c6d 100644 --- a/src/lib/libcrypto/lhash/lhash.h +++ b/src/lib/libcrypto/lhash/lhash.h | |||
| @@ -124,6 +124,7 @@ void *lh_retrieve(LHASH *lh, void *data); | |||
| 124 | void lh_doall(LHASH *lh, void (*func)(/*void *b*/)); | 124 | void lh_doall(LHASH *lh, void (*func)(/*void *b*/)); |
| 125 | void lh_doall_arg(LHASH *lh, void (*func)(/*void *a,void *b*/),void *arg); | 125 | void lh_doall_arg(LHASH *lh, void (*func)(/*void *a,void *b*/),void *arg); |
| 126 | unsigned long lh_strhash(const char *c); | 126 | unsigned long lh_strhash(const char *c); |
| 127 | unsigned long lh_num_items(LHASH *lh); | ||
| 127 | 128 | ||
| 128 | #ifndef NO_FP_API | 129 | #ifndef NO_FP_API |
| 129 | void lh_stats(LHASH *lh, FILE *out); | 130 | void lh_stats(LHASH *lh, FILE *out); |
