2005-01-13 19:39:26 +02:00
|
|
|
#ifndef _SHA_H
|
|
|
|
#define _SHA_H
|
|
|
|
|
2005-05-04 19:32:54 +03:00
|
|
|
#include <inttypes.h>
|
2005-01-13 19:39:26 +02:00
|
|
|
|
|
|
|
/* The SHA block size and message digest sizes, in bytes */
|
|
|
|
|
|
|
|
#define SHA_DATASIZE 64
|
|
|
|
#define SHA_DATALEN 16
|
|
|
|
#define SHA_DIGESTSIZE 20
|
|
|
|
#define SHA_DIGESTLEN 5
|
|
|
|
/* The structure for storing SHA info */
|
|
|
|
|
2006-02-13 21:52:43 +02:00
|
|
|
struct SHA_CTX {
|
2005-01-13 19:39:26 +02:00
|
|
|
uint32_t digest[SHA_DIGESTLEN]; /* Message digest */
|
|
|
|
uint32_t count_l, count_h; /* 64-bit block count */
|
|
|
|
uint8_t block[SHA_DATASIZE]; /* SHA data buffer */
|
|
|
|
unsigned int index; /* index into buffer */
|
|
|
|
};
|
|
|
|
|
2006-02-13 21:52:43 +02:00
|
|
|
void SHA1_Init(struct SHA_CTX *ctx);
|
|
|
|
void SHA1_Update(struct SHA_CTX *ctx, const unsigned char *buffer, uint32_t len);
|
|
|
|
void SHA1_Final(unsigned char *s, struct SHA_CTX *ctx);
|
|
|
|
void sha_digest(struct SHA_CTX *ctx, unsigned char *s);
|
|
|
|
void sha_copy(struct SHA_CTX *dest, struct SHA_CTX *src);
|
2005-01-13 19:39:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* !_SHA_H */
|