00001 #ifndef LDNS_SHA1_H 00002 #define LDNS_SHA1_H 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 #define LDNS_SHA1_BLOCK_LENGTH 64 00009 #define LDNS_SHA1_DIGEST_LENGTH 20 00010 00011 typedef struct { 00012 uint32_t state[5]; 00013 uint64_t count; 00014 unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]; 00015 } ldns_sha1_ctx; 00016 00017 void ldns_sha1_init(ldns_sha1_ctx * context); 00018 void ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]); 00019 void ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len); 00020 void ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context); 00021 00032 unsigned char *ldns_sha1(unsigned char *data, unsigned int data_len, unsigned char *digest); 00033 00034 #ifdef __cplusplus 00035 } 00036 #endif 00037 00038 #endif /* LDNS_SHA1_H */