Changeset View
Changeset View
Standalone View
Standalone View
contrib/ldns/ldns/sha2.h
Show All 40 Lines | |||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* $Id: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ | * $Id: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ | ||||
*/ | */ | ||||
#ifndef __LDNS_SHA2_H__ | #ifndef __LDNS_SHA2_H__ | ||||
#define __LDNS_SHA2_H__ | #define __LDNS_SHA2_H__ | ||||
#ifdef __cplusplus | #include <stdint.h> /* uint32_t and friends */ | ||||
extern "C" { | #include <stddef.h> /* size_t and NULL */ | ||||
#endif | |||||
/* | |||||
* Import u_intXX_t size_t type definitions from system headers. You | |||||
* may need to change this, or define these things yourself in this | |||||
* file. | |||||
*/ | |||||
#include <sys/types.h> | |||||
#if LDNS_BUILD_CONFIG_HAVE_INTTYPES_H | #if LDNS_BUILD_CONFIG_HAVE_INTTYPES_H | ||||
#include <inttypes.h> | # include <inttypes.h> | ||||
#endif | |||||
#endif /* LDNS_BUILD_CONFIG_HAVE_INTTYPES_H */ | #ifdef __cplusplus | ||||
extern "C" { | |||||
#endif | |||||
/*** SHA-256/384/512 Various Length Definitions ***********************/ | /*** SHA-256/384/512 Various Length Definitions ***********************/ | ||||
#define LDNS_SHA256_BLOCK_LENGTH 64 | #define LDNS_SHA256_BLOCK_LENGTH 64 | ||||
#define LDNS_SHA256_DIGEST_LENGTH 32 | #define LDNS_SHA256_DIGEST_LENGTH 32 | ||||
#define LDNS_SHA256_DIGEST_STRING_LENGTH (LDNS_SHA256_DIGEST_LENGTH * 2 + 1) | #define LDNS_SHA256_DIGEST_STRING_LENGTH (LDNS_SHA256_DIGEST_LENGTH * 2 + 1) | ||||
#define LDNS_SHA384_BLOCK_LENGTH 128 | #define LDNS_SHA384_BLOCK_LENGTH 128 | ||||
#define LDNS_SHA384_DIGEST_LENGTH 48 | #define LDNS_SHA384_DIGEST_LENGTH 48 | ||||
Show All 37 Lines | |||||
* | * | ||||
* \param[in] data the data to digest | * \param[in] data the data to digest | ||||
* \param[in] data_len the length of data in bytes | * \param[in] data_len the length of data in bytes | ||||
* \param[out] digest the length of data in bytes | * \param[out] digest the length of data in bytes | ||||
* This pointer MUST have LDNS_SHA256_DIGEST_LENGTH bytes | * This pointer MUST have LDNS_SHA256_DIGEST_LENGTH bytes | ||||
* available | * available | ||||
* \return the SHA1 digest of the given data | * \return the SHA1 digest of the given data | ||||
*/ | */ | ||||
unsigned char *ldns_sha256(unsigned char *data, unsigned int data_len, unsigned char *digest); | unsigned char *ldns_sha256(const unsigned char *data, unsigned int data_len, unsigned char *digest); | ||||
/** | /** | ||||
* Convenience function to digest a fixed block of data at once. | * Convenience function to digest a fixed block of data at once. | ||||
* | * | ||||
* \param[in] data the data to digest | * \param[in] data the data to digest | ||||
* \param[in] data_len the length of data in bytes | * \param[in] data_len the length of data in bytes | ||||
* \param[out] digest the length of data in bytes | * \param[out] digest the length of data in bytes | ||||
* This pointer MUST have LDNS_SHA384_DIGEST_LENGTH bytes | * This pointer MUST have LDNS_SHA384_DIGEST_LENGTH bytes | ||||
* available | * available | ||||
* \return the SHA1 digest of the given data | * \return the SHA1 digest of the given data | ||||
*/ | */ | ||||
unsigned char *ldns_sha384(unsigned char *data, unsigned int data_len, unsigned char *digest); | unsigned char *ldns_sha384(const unsigned char *data, unsigned int data_len, unsigned char *digest); | ||||
/** | /** | ||||
* Convenience function to digest a fixed block of data at once. | * Convenience function to digest a fixed block of data at once. | ||||
* | * | ||||
* \param[in] data the data to digest | * \param[in] data the data to digest | ||||
* \param[in] data_len the length of data in bytes | * \param[in] data_len the length of data in bytes | ||||
* \param[out] digest the length of data in bytes | * \param[out] digest the length of data in bytes | ||||
* This pointer MUST have LDNS_SHA512_DIGEST_LENGTH bytes | * This pointer MUST have LDNS_SHA512_DIGEST_LENGTH bytes | ||||
* available | * available | ||||
* \return the SHA1 digest of the given data | * \return the SHA1 digest of the given data | ||||
*/ | */ | ||||
unsigned char *ldns_sha512(unsigned char *data, unsigned int data_len, unsigned char *digest); | unsigned char *ldns_sha512(const unsigned char *data, unsigned int data_len, unsigned char *digest); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
} | } | ||||
#endif /* __cplusplus */ | #endif /* __cplusplus */ | ||||
#endif /* __LDNS_SHA2_H__ */ | #endif /* __LDNS_SHA2_H__ */ |