sha1.h File Reference

Go to the source code of this file.

## Data Structures

struct | ldns_sha1_ctx

## Macros

#define | LDNS_SHA1_BLOCK_LENGTH 64
#define | LDNS_SHA1_DIGEST_LENGTH 20

## Functions

void | ldns_sha1_init (ldns_sha1_ctx *context)
void | ldns_sha1_transform (uint32_t state[5], const unsigned char buffer[64])
void | ldns_sha1_update (ldns_sha1_ctx *context, const unsigned char *data, unsigned int len)
void | ldns_sha1_final (unsigned char digest[20], ldns_sha1_ctx *context)
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.

## Macro Definition Documentation

## LDNS_SHA1_BLOCK_LENGTH

#define LDNS_SHA1_BLOCK_LENGTH 64

Definition at line 15 of file sha1.h.

## LDNS_SHA1_DIGEST_LENGTH

#define LDNS_SHA1_DIGEST_LENGTH 20

Definition at line 16 of file sha1.h.

## Function Documentation

## ldns_sha1_init()

void ldns_sha1_init | ( | ldns_sha1_ctx * | context | ) |

Definition at line 107 of file sha1.c.

References ldns_sha1_ctx::count, and ldns_sha1_ctx::state.

## ldns_sha1_transform()

void ldns_sha1_transform | ( | uint32_t | state[5],
|  | const unsigned char | buffer[64]
| ) |  |

## ldns_sha1_update()

void ldns_sha1_update | ( | ldns_sha1_ctx * | context,
|  | const unsigned char * | data,
|  | unsigned int | len
| ) |  |

Definition at line 122 of file sha1.c.

References ldns_sha1_ctx::buffer, ldns_sha1_ctx::count, ldns_sha1_transform(), and ldns_sha1_ctx::state.

## ldns_sha1_final()

void ldns_sha1_final | ( | unsigned char | digest[20],
|  | ldns_sha1_ctx * | context
| ) |  |

## 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.

Parameters

  [in] | data | the data to digest
  [in] | data_len | the length of data in bytes
  [out] | digest | the length of data in bytes This pointer MUST have LDNS_SHA1_DIGEST_LENGTH bytes available

Returns
  the SHA1 digest of the given data

Definition at line 171 of file sha1.c.

References ldns_sha1_final(), ldns_sha1_init(), and ldns_sha1_update().