- update OpenSSL to 0.9.8
[dragonfly.git] / secure / lib / libcrypto / man / lhash.3
CommitLineData
8b0cefbb
JR
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
984263bc
MD
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
8b0cefbb 13.de Sp \" Vertical space (when we can't use .PP)
984263bc
MD
14.if t .sp .5v
15.if n .sp
16..
8b0cefbb 17.de Vb \" Begin verbatim text
984263bc
MD
18.ft CW
19.nf
20.ne \\$1
21..
8b0cefbb 22.de Ve \" End verbatim text
984263bc 23.ft R
984263bc
MD
24.fi
25..
8b0cefbb
JR
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
984263bc 32.tr \(*W-|\(bv\*(Tr
8b0cefbb 33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
984263bc 34.ie n \{\
8b0cefbb
JR
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
984263bc
MD
43'br\}
44.el\{\
8b0cefbb
JR
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
984263bc 49'br\}
8b0cefbb
JR
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
984263bc 58..
8b0cefbb
JR
59. nr % 0
60. rr F
984263bc 61.\}
8b0cefbb
JR
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
984263bc 66.if n .na
8b0cefbb
JR
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
984263bc 71.if n \{\
8b0cefbb
JR
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
984263bc
MD
77.\}
78.if t \{\
8b0cefbb
JR
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
984263bc 84.\}
8b0cefbb 85. \" simple accents for nroff and troff
984263bc 86.if n \{\
8b0cefbb
JR
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
984263bc
MD
93.\}
94.if t \{\
8b0cefbb
JR
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
984263bc 101.\}
8b0cefbb 102. \" troff and (daisy-wheel) nroff accents
984263bc
MD
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
8b0cefbb 112. \" corrections for vroff
984263bc
MD
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
8b0cefbb 115. \" for low resolution devices (crt and lpr)
984263bc
MD
116.if \n(.H>23 .if \n(.V>19 \
117\{\
8b0cefbb
JR
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
984263bc
MD
127.\}
128.rm #[ #] #H #V #F C
8b0cefbb
JR
129.\" ========================================================================
130.\"
131.IX Title "lhash 3"
a561f9ff 132.TH lhash 3 "2005-07-06" "0.9.8" "OpenSSL"
984263bc
MD
133.SH "NAME"
134lh_new, lh_free, lh_insert, lh_delete, lh_retrieve, lh_doall, lh_doall_arg, lh_error \- dynamic hash table
135.SH "SYNOPSIS"
8b0cefbb 136.IX Header "SYNOPSIS"
984263bc
MD
137.Vb 1
138\& #include <openssl/lhash.h>
139.Ve
8b0cefbb 140.PP
984263bc
MD
141.Vb 2
142\& LHASH *lh_new(LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE compare);
143\& void lh_free(LHASH *table);
144.Ve
8b0cefbb 145.PP
984263bc
MD
146.Vb 3
147\& void *lh_insert(LHASH *table, void *data);
148\& void *lh_delete(LHASH *table, void *data);
149\& void *lh_retrieve(LHASH *table, void *data);
150.Ve
8b0cefbb 151.PP
984263bc
MD
152.Vb 3
153\& void lh_doall(LHASH *table, LHASH_DOALL_FN_TYPE func);
154\& void lh_doall_arg(LHASH *table, LHASH_DOALL_ARG_FN_TYPE func,
155\& void *arg);
156.Ve
8b0cefbb 157.PP
984263bc
MD
158.Vb 1
159\& int lh_error(LHASH *table);
160.Ve
8b0cefbb 161.PP
984263bc
MD
162.Vb 4
163\& typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
164\& typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
165\& typedef void (*LHASH_DOALL_FN_TYPE)(const void *);
166\& typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *);
167.Ve
168.SH "DESCRIPTION"
8b0cefbb 169.IX Header "DESCRIPTION"
984263bc
MD
170This library implements dynamic hash tables. The hash table entries
171can be arbitrary structures. Usually they consist of key and value
172fields.
173.PP
8b0cefbb
JR
174\&\fIlh_new()\fR creates a new \fB\s-1LHASH\s0\fR structure to store arbitrary data
175entries, and provides the 'hash' and 'compare' callbacks to be used in
984263bc
MD
176organising the table's entries. The \fBhash\fR callback takes a pointer
177to a table entry as its argument and returns an unsigned long hash
178value for its key field. The hash value is normally truncated to a
179power of 2, so make sure that your hash function returns well mixed
180low order bits. The \fBcompare\fR callback takes two arguments (pointers
181to two hash table entries), and returns 0 if their keys are equal,
182non-zero otherwise. If your hash table will contain items of some
183particular type and the \fBhash\fR and \fBcompare\fR callbacks hash/compare
8b0cefbb
JR
184these types, then the \fB\s-1DECLARE_LHASH_HASH_FN\s0\fR and
185\&\fB\s-1IMPLEMENT_LHASH_COMP_FN\s0\fR macros can be used to create callback
984263bc
MD
186wrappers of the prototypes required by \fIlh_new()\fR. These provide
187per-variable casts before calling the type-specific callbacks written
188by the application author. These macros, as well as those used for
189the \*(L"doall\*(R" callbacks, are defined as;
190.PP
191.Vb 7
192\& #define DECLARE_LHASH_HASH_FN(f_name,o_type) \e
193\& unsigned long f_name##_LHASH_HASH(const void *);
194\& #define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \e
195\& unsigned long f_name##_LHASH_HASH(const void *arg) { \e
196\& o_type a = (o_type)arg; \e
197\& return f_name(a); }
198\& #define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH
199.Ve
8b0cefbb 200.PP
984263bc
MD
201.Vb 8
202\& #define DECLARE_LHASH_COMP_FN(f_name,o_type) \e
203\& int f_name##_LHASH_COMP(const void *, const void *);
204\& #define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \e
205\& int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \e
206\& o_type a = (o_type)arg1; \e
207\& o_type b = (o_type)arg2; \e
208\& return f_name(a,b); }
209\& #define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP
210.Ve
8b0cefbb 211.PP
984263bc
MD
212.Vb 7
213\& #define DECLARE_LHASH_DOALL_FN(f_name,o_type) \e
214\& void f_name##_LHASH_DOALL(const void *);
215\& #define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \e
216\& void f_name##_LHASH_DOALL(const void *arg) { \e
217\& o_type a = (o_type)arg; \e
218\& f_name(a); }
219\& #define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL
220.Ve
8b0cefbb 221.PP
984263bc
MD
222.Vb 8
223\& #define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \e
224\& void f_name##_LHASH_DOALL_ARG(const void *, const void *);
225\& #define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \e
226\& void f_name##_LHASH_DOALL_ARG(const void *arg1, const void *arg2) { \e
227\& o_type a = (o_type)arg1; \e
228\& a_type b = (a_type)arg2; \e
229\& f_name(a,b); }
230\& #define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG
231.Ve
8b0cefbb
JR
232.PP
233An example of a hash table storing (pointers to) structures of type '\s-1STUFF\s0'
984263bc
MD
234could be defined as follows;
235.PP
236.Vb 14
237\& /* Calculates the hash value of 'tohash' (implemented elsewhere) */
238\& unsigned long STUFF_hash(const STUFF *tohash);
239\& /* Orders 'arg1' and 'arg2' (implemented elsewhere) */
240\& int STUFF_cmp(const STUFF *arg1, const STUFF *arg2);
241\& /* Create the type-safe wrapper functions for use in the LHASH internals */
242\& static IMPLEMENT_LHASH_HASH_FN(STUFF_hash, const STUFF *)
243\& static IMPLEMENT_LHASH_COMP_FN(STUFF_cmp, const STUFF *);
244\& /* ... */
245\& int main(int argc, char *argv[]) {
246\& /* Create the new hash table using the hash/compare wrappers */
247\& LHASH *hashtable = lh_new(LHASH_HASH_FN(STUFF_hash),
248\& LHASH_COMP_FN(STUFF_cmp));
249\& /* ... */
250\& }
251.Ve
8b0cefbb
JR
252.PP
253\&\fIlh_free()\fR frees the \fB\s-1LHASH\s0\fR structure \fBtable\fR. Allocated hash table
984263bc
MD
254entries will not be freed; consider using \fIlh_doall()\fR to deallocate any
255remaining entries in the hash table (see below).
256.PP
8b0cefbb 257\&\fIlh_insert()\fR inserts the structure pointed to by \fBdata\fR into \fBtable\fR.
984263bc
MD
258If there already is an entry with the same key, the old value is
259replaced. Note that \fIlh_insert()\fR stores pointers, the data are not
260copied.
261.PP
8b0cefbb 262\&\fIlh_delete()\fR deletes an entry from \fBtable\fR.
984263bc 263.PP
8b0cefbb
JR
264\&\fIlh_retrieve()\fR looks up an entry in \fBtable\fR. Normally, \fBdata\fR is
265a structure with the key field(s) set; the function will return a
984263bc
MD
266pointer to a fully populated structure.
267.PP
8b0cefbb 268\&\fIlh_doall()\fR will, for every entry in the hash table, call \fBfunc\fR with
984263bc
MD
269the data item as its parameter. For \fIlh_doall()\fR and \fIlh_doall_arg()\fR,
270function pointer casting should be avoided in the callbacks (see
8b0cefbb 271\&\fB\s-1NOTE\s0\fR) \- instead, either declare the callbacks to match the
984263bc
MD
272prototype required in \fIlh_new()\fR or use the declare/implement macros to
273create type-safe wrappers that cast variables prior to calling your
274type-specific callbacks. An example of this is illustrated here where
275the callback is used to cleanup resources for items in the hash table
276prior to the hashtable itself being deallocated:
277.PP
278.Vb 9
279\& /* Cleans up resources belonging to 'a' (this is implemented elsewhere) */
280\& void STUFF_cleanup(STUFF *a);
281\& /* Implement a prototype-compatible wrapper for "STUFF_cleanup" */
282\& IMPLEMENT_LHASH_DOALL_FN(STUFF_cleanup, STUFF *)
283\& /* ... then later in the code ... */
284\& /* So to run "STUFF_cleanup" against all items in a hash table ... */
285\& lh_doall(hashtable, LHASH_DOALL_FN(STUFF_cleanup));
286\& /* Then the hash table itself can be deallocated */
287\& lh_free(hashtable);
288.Ve
8b0cefbb 289.PP
984263bc
MD
290When doing this, be careful if you delete entries from the hash table
291in your callbacks: the table may decrease in size, moving the item
292that you are currently on down lower in the hash table \- this could
293cause some entries to be skipped during the iteration. The second
8b0cefbb 294best solution to this problem is to set hash\->down_load=0 before
984263bc
MD
295you start (which will stop the hash table ever decreasing in size).
296The best solution is probably to avoid deleting items from the hash
297table inside a \*(L"doall\*(R" callback!
298.PP
8b0cefbb 299\&\fIlh_doall_arg()\fR is the same as \fIlh_doall()\fR except that \fBfunc\fR will be
984263bc 300called with \fBarg\fR as the second argument and \fBfunc\fR should be of
8b0cefbb 301type \fB\s-1LHASH_DOALL_ARG_FN_TYPE\s0\fR (a callback prototype that is passed
984263bc
MD
302both the table entry and an extra argument). As with \fIlh_doall()\fR, you
303can instead choose to declare your callback with a prototype matching
304the types you are dealing with and use the declare/implement macros to
305create compatible wrappers that cast variables before calling your
306type-specific callbacks. An example of this is demonstrated here
8b0cefbb 307(printing all hash table entries to a \s-1BIO\s0 that is provided by the
984263bc
MD
308caller):
309.PP
8b0cefbb 310.Vb 7
984263bc
MD
311\& /* Prints item 'a' to 'output_bio' (this is implemented elsewhere) */
312\& void STUFF_print(const STUFF *a, BIO *output_bio);
313\& /* Implement a prototype-compatible wrapper for "STUFF_print" */
314\& static IMPLEMENT_LHASH_DOALL_ARG_FN(STUFF_print, const STUFF *, BIO *)
315\& /* ... then later in the code ... */
316\& /* Print out the entire hashtable to a particular BIO */
317\& lh_doall_arg(hashtable, LHASH_DOALL_ARG_FN(STUFF_print), logging_bio);
318.Ve
8b0cefbb
JR
319.PP
320\&\fIlh_error()\fR can be used to determine if an error occurred in the last
321operation. \fIlh_error()\fR is a macro.
984263bc 322.SH "RETURN VALUES"
8b0cefbb
JR
323.IX Header "RETURN VALUES"
324\&\fIlh_new()\fR returns \fB\s-1NULL\s0\fR on error, otherwise a pointer to the new
325\&\fB\s-1LHASH\s0\fR structure.
984263bc
MD
326.PP
327When a hash table entry is replaced, \fIlh_insert()\fR returns the value
8b0cefbb 328being replaced. \fB\s-1NULL\s0\fR is returned on normal operation and on error.
984263bc 329.PP
8b0cefbb 330\&\fIlh_delete()\fR returns the entry being deleted. \fB\s-1NULL\s0\fR is returned if
984263bc
MD
331there is no such value in the hash table.
332.PP
8b0cefbb
JR
333\&\fIlh_retrieve()\fR returns the hash table entry if it has been found,
334\&\fB\s-1NULL\s0\fR otherwise.
984263bc 335.PP
8b0cefbb 336\&\fIlh_error()\fR returns 1 if an error occurred in the last operation, 0
984263bc
MD
337otherwise.
338.PP
8b0cefbb 339\&\fIlh_free()\fR, \fIlh_doall()\fR and \fIlh_doall_arg()\fR return no values.
984263bc 340.SH "NOTE"
8b0cefbb
JR
341.IX Header "NOTE"
342The various \s-1LHASH\s0 macros and callback types exist to make it possible
984263bc
MD
343to write type-safe code without resorting to function-prototype
344casting \- an evil that makes application code much harder to
345audit/verify and also opens the window of opportunity for stack
346corruption and other hard-to-find bugs. It also, apparently, violates
8b0cefbb 347\&\s-1ANSI\-C\s0.
984263bc 348.PP
8b0cefbb 349The \s-1LHASH\s0 code regards table entries as constant data. As such, it
984263bc
MD
350internally represents \fIlh_insert()\fR'd items with a \*(L"const void *\*(R"
351pointer type. This is why callbacks such as those used by \fIlh_doall()\fR
352and \fIlh_doall_arg()\fR declare their prototypes with \*(L"const\*(R", even for the
8b0cefbb 353parameters that pass back the table items' data pointers \- for
984263bc 354consistency, user-provided data is \*(L"const\*(R" at all times as far as the
8b0cefbb 355\&\s-1LHASH\s0 code is concerned. However, as callers are themselves providing
984263bc
MD
356these pointers, they can choose whether they too should be treating
357all such parameters as constant.
358.PP
359As an example, a hash table may be maintained by code that, for
360reasons of encapsulation, has only \*(L"const\*(R" access to the data being
361indexed in the hash table (ie. it is returned as \*(L"const\*(R" from
8b0cefbb
JR
362elsewhere in their code) \- in this case the \s-1LHASH\s0 prototypes are
363appropriate as\-is. Conversely, if the caller is responsible for the
984263bc
MD
364life-time of the data in question, then they may well wish to make
365modifications to table item passed back in the \fIlh_doall()\fR or
8b0cefbb 366\&\fIlh_doall_arg()\fR callbacks (see the \*(L"STUFF_cleanup\*(R" example above). If
984263bc
MD
367so, the caller can either cast the \*(L"const\*(R" away (if they're providing
368the raw callbacks themselves) or use the macros to declare/implement
369the wrapper functions without \*(L"const\*(R" types.
370.PP
371Callers that only have \*(L"const\*(R" access to data they're indexing in a
372table, yet declare callbacks without constant types (or cast the
8b0cefbb
JR
373\&\*(L"const\*(R" away themselves), are therefore creating their own risks/bugs
374without being encouraged to do so by the \s-1API\s0. On a related note,
984263bc 375those auditing code should pay special attention to any instances of
8b0cefbb 376DECLARE/IMPLEMENT_LHASH_DOALL_[\s-1ARG_\s0]_FN macros that provide types
984263bc
MD
377without any \*(L"const\*(R" qualifiers.
378.SH "BUGS"
8b0cefbb
JR
379.IX Header "BUGS"
380\&\fIlh_insert()\fR returns \fB\s-1NULL\s0\fR both for success and error.
984263bc 381.SH "INTERNALS"
8b0cefbb 382.IX Header "INTERNALS"
984263bc
MD
383The following description is based on the SSLeay documentation:
384.PP
385The \fBlhash\fR library implements a hash table described in the
8b0cefbb 386\&\fICommunications of the \s-1ACM\s0\fR in 1991. What makes this hash table
984263bc 387different is that as the table fills, the hash table is increased (or
8b0cefbb
JR
388decreased) in size via \fIOPENSSL_realloc()\fR. When a 'resize' is done, instead of
389all hashes being redistributed over twice as many 'buckets', one
390bucket is split. So when an 'expand' is done, there is only a minimal
984263bc 391cost to redistribute some values. Subsequent inserts will cause more
8b0cefbb
JR
392single 'bucket' redistributions but there will never be a sudden large
393cost due to redistributing all the 'buckets'.
984263bc 394.PP
8b0cefbb 395The state for a particular hash table is kept in the \fB\s-1LHASH\s0\fR structure.
984263bc 396The decision to increase or decrease the hash table size is made
8b0cefbb 397depending on the 'load' of the hash table. The load is the number of
984263bc 398items in the hash table divided by the size of the hash table. The
8b0cefbb
JR
399default values are as follows. If (hash\->up_load < load) =>
400expand. if (hash\->down_load > load) => contract. The
401\&\fBup_load\fR has a default value of 1 and \fBdown_load\fR has a default value
984263bc 402of 2. These numbers can be modified by the application by just
8b0cefbb 403playing with the \fBup_load\fR and \fBdown_load\fR variables. The 'load' is
984263bc 404kept in a form which is multiplied by 256. So
8b0cefbb 405hash\->up_load=8*256; will cause a load of 8 to be set.
984263bc
MD
406.PP
407If you are interested in performance the field to watch is
8b0cefbb
JR
408num_comp_calls. The hash library keeps track of the 'hash' value for
409each item so when a lookup is done, the 'hashes' are compared, if
984263bc 410there is a match, then a full compare is done, and
8b0cefbb 411hash\->num_comp_calls is incremented. If num_comp_calls is not equal
984263bc
MD
412to num_delete plus num_retrieve it means that your hash function is
413generating hashes that are the same for different values. It is
414probably worth changing your hash function if this is the case because
8b0cefbb 415even if your hash table has 10 items in a 'bucket', it can be searched
984263bc
MD
416with 10 \fBunsigned long\fR compares and 10 linked list traverses. This
417will be much less expensive that 10 calls to your compare function.
418.PP
8b0cefbb 419\&\fIlh_strhash()\fR is a demo string hashing function:
984263bc
MD
420.PP
421.Vb 1
422\& unsigned long lh_strhash(const char *c);
423.Ve
8b0cefbb
JR
424.PP
425Since the \fB\s-1LHASH\s0\fR routines would normally be passed structures, this
984263bc
MD
426routine would not normally be passed to \fIlh_new()\fR, rather it would be
427used in the function passed to \fIlh_new()\fR.
428.SH "SEE ALSO"
8b0cefbb
JR
429.IX Header "SEE ALSO"
430\&\fIlh_stats\fR\|(3)
984263bc 431.SH "HISTORY"
8b0cefbb 432.IX Header "HISTORY"
984263bc 433The \fBlhash\fR library is available in all versions of SSLeay and OpenSSL.
8b0cefbb 434\&\fIlh_error()\fR was added in SSLeay 0.9.1b.
984263bc
MD
435.PP
436This manpage is derived from the SSLeay documentation.
437.PP
438In OpenSSL 0.9.7, all lhash functions that were passed function pointers
8b0cefbb
JR
439were changed for better type safety, and the function types \s-1LHASH_COMP_FN_TYPE\s0,
440\&\s-1LHASH_HASH_FN_TYPE\s0, \s-1LHASH_DOALL_FN_TYPE\s0 and \s-1LHASH_DOALL_ARG_FN_TYPE\s0
984263bc 441became available.