sha256.h 554 Bytes
Newer Older
Bernhard Link's avatar
Bernhard Link committed
1 2 3 4 5 6 7 8 9 10
#ifndef REPREPRO_SHA256_H
#define REPREPRO_SHA256_H

/* Structure to save state of computation between the single steps.  */
struct SHA256_Context
{
  uint32_t H[8];

  uint64_t total;
  uint32_t buflen;
11
  char buffer[128]; /* NB: always correctly aligned for uint32_t.  */
Bernhard Link's avatar
Bernhard Link committed
12 13 14 15 16 17 18 19 20
};

#define SHA256_DIGEST_SIZE 32

void SHA256Init(/*@out@*/struct SHA256_Context *context);
void SHA256Update(struct SHA256_Context *context, const uint8_t *data, size_t len);
void SHA256Final(struct SHA256_Context *context, /*@out@*/uint8_t digest[SHA256_DIGEST_SIZE]);

#endif