/***************************************************************************/
/* sha.h								   */
/*									   */
/* SHA-1 code header file.						   */
/* Taken from the public domain implementation by Peter C. Gutmann	   */
/* on 2 Sep 1992, modified by Carl Ellison to be SHA-1.			   */
/***************************************************************************/

#ifndef _SHA_H_
#define _SHA_H_

#include <stdint.h>

/* Define APG_LITTLE_ENDIAN if the machine is little-endian */

#define APG_LITTLE_ENDIAN

/* Useful defines/typedefs */

typedef uint8_t    BYTE ;
typedef uint32_t   LONG ;

/* The SHA block size and message digest sizes, in bytes */

#define SHA_BLOCKSIZE   64
#define SHA_DIGESTSIZE  20

/* The structure for storing SHA info */

typedef struct {
  LONG digest[ 5 ] ;            /* Message digest */
  uint64_t count ;              /* 64-bit bit count */
  LONG data[ 16 ] ;             /* SHA data buffer */
  LONG slop ;			/* # of bytes saved in data[] */
} apg_SHA_INFO ;

void apg_shaInit( apg_SHA_INFO *shaInfo ) ;
void apg_shaUpdate( apg_SHA_INFO *shaInfo, BYTE const buffer[*], int count ) ;
void apg_shaFinal( apg_SHA_INFO *shaInfo, BYTE hash[static const SHA_DIGESTSIZE] ) ;

#endif /* _SHA_H_ */
