00001
00005 #ifndef _SHA2_H
00006 #define _SHA2_H
00007
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011
00015 typedef struct
00016 {
00017 unsigned long total[2];
00018 unsigned long state[8];
00019 unsigned char buffer[64];
00020 unsigned char ipad[64];
00021 unsigned char opad[64];
00022 int is224;
00023 }
00024 sha2_context;
00025
00032 void sha2_starts( sha2_context *ctx, int is224 );
00033
00041 void sha2_update( sha2_context *ctx, unsigned char *input, int ilen );
00042
00049 void sha2_finish( sha2_context *ctx, unsigned char *output );
00050
00059 void sha2( unsigned char *input, int ilen,
00060 unsigned char *output, int is224 );
00061
00072 int sha2_file( char *path, unsigned char *output, int is224 );
00073
00082 void sha2_hmac_starts( sha2_context *ctx, int is224,
00083 unsigned char *key, int keylen );
00084
00092 void sha2_hmac_update( sha2_context *ctx,
00093 unsigned char *input, int ilen );
00094
00101 void sha2_hmac_finish( sha2_context *ctx, unsigned char *output );
00102
00113 void sha2_hmac( unsigned char *key, int keylen,
00114 unsigned char *input, int ilen,
00115 unsigned char *output, int is224 );
00116
00122 int sha2_self_test( int verbose );
00123
00124 #ifdef __cplusplus
00125 }
00126 #endif
00127
00128 #endif