1 /*	$NetBSD: iterated_hash.h,v 1.6 2020/05/25 20:47:21 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2008  Internet Systems Consortium, Inc. ("ISC")
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /* Id: iterated_hash.h,v 1.3 2008/09/25 04:02:39 tbox Exp  */
20 
21 #ifndef ISC_ITERATED_HASH_H
22 #define ISC_ITERATED_HASH_H 1
23 
24 #include <isc/lang.h>
25 #include <isc/sha1.h>
26 
27 /*
28  * The maximal hash length that can be encoded it a name
29  * using base32hex.  floor(255/8)*5
30  */
31 #define NSEC3_MAX_HASH_LENGTH 155
32 
33 /*
34  * The maximum has that can be encoded in a single label using
35  * base32hex.  floor(63/8)*5
36  */
37 #define NSEC3_MAX_LABEL_HASH 35
38 
39 ISC_LANG_BEGINDECLS
40 
41 int isc_iterated_hash(unsigned char out[NSEC3_MAX_HASH_LENGTH],
42 		      unsigned int hashalg, int iterations,
43 		      const unsigned char *salt, int saltlength,
44 		      const unsigned char *in, int inlength);
45 
46 
47 ISC_LANG_ENDDECLS
48 
49 #endif /* ISC_ITERATED_HASH_H */
50