1258945Sroberto/*
2258945Sroberto * Copyright (C) 2008  Internet Systems Consortium, Inc. ("ISC")
3258945Sroberto *
4258945Sroberto * Permission to use, copy, modify, and/or distribute this software for any
5258945Sroberto * purpose with or without fee is hereby granted, provided that the above
6258945Sroberto * copyright notice and this permission notice appear in all copies.
7258945Sroberto *
8258945Sroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9258945Sroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10258945Sroberto * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11258945Sroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12258945Sroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13258945Sroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14258945Sroberto * PERFORMANCE OF THIS SOFTWARE.
15258945Sroberto */
16258945Sroberto
17258945Sroberto/* $Id: iterated_hash.h,v 1.3 2008/09/25 04:02:39 tbox Exp $ */
18258945Sroberto
19258945Sroberto#ifndef ISC_ITERATED_HASH_H
20258945Sroberto#define ISC_ITERATED_HASH_H 1
21258945Sroberto
22258945Sroberto#include <isc/lang.h>
23258945Sroberto#include <isc/sha1.h>
24258945Sroberto
25258945Sroberto/*
26258945Sroberto * The maximal hash length that can be encoded it a name
27258945Sroberto * using base32hex.  floor(255/8)*5
28258945Sroberto */
29258945Sroberto#define NSEC3_MAX_HASH_LENGTH 155
30258945Sroberto
31258945Sroberto/*
32258945Sroberto * The maximum has that can be encoded in a single label using
33258945Sroberto * base32hex.  floor(63/8)*5
34258945Sroberto */
35258945Sroberto#define NSEC3_MAX_LABEL_HASH 35
36258945Sroberto
37258945SrobertoISC_LANG_BEGINDECLS
38258945Sroberto
39258945Srobertoint isc_iterated_hash(unsigned char out[NSEC3_MAX_HASH_LENGTH],
40258945Sroberto		      unsigned int hashalg, int iterations,
41258945Sroberto		      const unsigned char *salt, int saltlength,
42258945Sroberto		      const unsigned char *in, int inlength);
43258945Sroberto
44258945Sroberto
45258945SrobertoISC_LANG_ENDDECLS
46258945Sroberto
47258945Sroberto#endif /* ISC_ITERATED_HASH_H */
48