#if !defined( _sha1_h )
#define _sha1_h

#include "types.h"

#define SHA1_INPUT_BYTES 64	/* 512 bits */
#define SHA1_INPUT_WORDS ( SHA1_INPUT_BYTES / 4 )
#define SHA1_DIGEST_BYTES 20	/* 160 bits */
#define SHA1_DIGEST_WORDS ( SHA1_DIGEST_BYTES / 4 )
#define SHA1_INPUT_MASK	(SHA1_INPUT_BYTES-1)

typedef struct {
    word32 H[ SHA1_DIGEST_WORDS ];
    word64 counter;		/* 64 bit counter */
    byte M[ SHA1_INPUT_BYTES ];
} SHA1_ctx;


#if defined( __cplusplus )
extern "C" {
#endif

/* inputs and outputs are big endian, internally uses local endian */

void SHA1_init  ( SHA1_ctx* );
void SHA1_update( SHA1_ctx*, const void*, word32 );
void SHA1_final ( SHA1_ctx*, byte[ SHA1_DIGEST_BYTES ] );

/* these provide extra access to internals of SHA1 for MDC and MACs */

void SHA1_init_with_IV( SHA1_ctx*, const byte[ SHA1_DIGEST_BYTES ] );
void SHA1_transform( word32[ SHA1_DIGEST_WORDS ], 
		     const byte[ SHA1_INPUT_BYTES ] );

#if defined( VERBOSE )
extern int sha1_verbose;
#endif

#if defined( __cplusplus )
}
#endif

#endif
