sha1.h
Go to the documentation of this file.
#ifndef LDNS_SHA1_H
#define LDNS_SHA1_H
#include <stdint.h> /* uint32_t and friends */
#include <stddef.h> /* size_t and NULL */
#if LDNS_BUILD_CONFIG_HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define LDNS_SHA1_BLOCK_LENGTH 64
#define LDNS_SHA1_DIGEST_LENGTH 20
typedef struct {
uint32_t state[5];
uint64_t count;
unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH];
} ldns_sha1_ctx;
void ldns_sha1_init(ldns_sha1_ctx * context);
void ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]);
void ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len);
void ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context);
unsigned char *ldns_sha1(const unsigned char *data, unsigned int data_len, unsigned char *digest);
#ifdef __cplusplus
}
#endif
#endif /* LDNS_SHA1_H */
ldns_sha1
unsigned char * ldns_sha1(const unsigned char *data, unsigned int data_len, unsigned char *digest)
Convenience function to digest a fixed block of data at once.
Definition sha1.c:171
LDNS_SHA1_DIGEST_LENGTH
#define LDNS_SHA1_DIGEST_LENGTH
Definition sha1.h:16
LDNS_SHA1_BLOCK_LENGTH
#define LDNS_SHA1_BLOCK_LENGTH
Definition sha1.h:15
ldns_sha1_update
void ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len)
Definition sha1.c:122
ldns_sha1_transform
void ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[64])
ldns_sha1_final
void ldns_sha1_final(unsigned char digest[20], ldns_sha1_ctx *context)
ldns_sha1_init
void ldns_sha1_init(ldns_sha1_ctx *context)
Definition sha1.c:107
ldns_sha1_ctx
Definition sha1.h:18
ldns_sha1_ctx::count
uint64_t count
Definition sha1.h:20