sha1.h
Go to the documentation of this file.
1 #ifndef LDNS_SHA1_H
2 #define LDNS_SHA1_H
3 
4 #include <stdint.h> /* uint32_t and friends */
5 #include <stddef.h> /* size_t and NULL */
6 
7 #if LDNS_BUILD_CONFIG_HAVE_INTTYPES_H
8 # include <inttypes.h>
9 #endif
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #define LDNS_SHA1_BLOCK_LENGTH 64
16 #define LDNS_SHA1_DIGEST_LENGTH 20
17 
18 typedef struct {
19  uint32_t state[5];
20  uint64_t count;
21  unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH];
23 
24 void ldns_sha1_init(ldns_sha1_ctx * context);
25 void ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]);
26 void ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len);
27 void ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context);
28 
39 unsigned char *ldns_sha1(const unsigned char *data, unsigned int data_len, unsigned char *digest);
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* LDNS_SHA1_H */
#define LDNS_SHA1_DIGEST_LENGTH
Definition: sha1.h:16
#define LDNS_SHA1_BLOCK_LENGTH
Definition: sha1.h:15
void ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len)
Definition: sha1.c:122
void ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[64])
Definition: sha1.c:47
void ldns_sha1_final(unsigned char digest[20], ldns_sha1_ctx *context)
Definition: sha1.c:145
void ldns_sha1_init(ldns_sha1_ctx *context)
Definition: sha1.c:107
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
uint64_t count
Definition: sha1.h:20