00001 /* 00002 * Copyright (C) 2008, 2014 Internet Systems Consortium, Inc. ("ISC") 00003 * 00004 * Permission to use, copy, modify, and/or distribute this software for any 00005 * purpose with or without fee is hereby granted, provided that the above 00006 * copyright notice and this permission notice appear in all copies. 00007 * 00008 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00009 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00010 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00011 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00012 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00013 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00014 * PERFORMANCE OF THIS SOFTWARE. 00015 */ 00016 00017 /* $Id: iterated_hash.h,v 1.3 2008/09/25 04:02:39 tbox Exp $ */ 00018 00019 #ifndef ISC_ITERATED_HASH_H 00020 #define ISC_ITERATED_HASH_H 1 00021 00022 #include <isc/lang.h> 00023 #include <isc/sha1.h> 00024 00025 /* 00026 * The maximal hash length that can be encoded in a name 00027 * using base32hex. floor(255/8)*5 00028 */ 00029 #define NSEC3_MAX_HASH_LENGTH 155 00030 00031 /* 00032 * The maximum has that can be encoded in a single label using 00033 * base32hex. floor(63/8)*5 00034 */ 00035 #define NSEC3_MAX_LABEL_HASH 35 00036 00037 ISC_LANG_BEGINDECLS 00038 00039 int isc_iterated_hash(unsigned char out[NSEC3_MAX_HASH_LENGTH], 00040 unsigned int hashalg, int iterations, 00041 const unsigned char *salt, int saltlength, 00042 const unsigned char *in, int inlength); 00043 00044 00045 ISC_LANG_ENDDECLS 00046 00047 #endif /* ISC_ITERATED_HASH_H */