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