PolarSSL v1.2.5
sha1.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_SHA1_H
28 #define POLARSSL_SHA1_H
29 
30 #include <string.h>
31 
32 #ifdef _MSC_VER
33 #include <basetsd.h>
34 typedef UINT32 uint32_t;
35 #else
36 #include <inttypes.h>
37 #endif
38 
39 #define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076
44 typedef struct
45 {
46  uint32_t total[2];
47  uint32_t state[5];
48  unsigned char buffer[64];
50  unsigned char ipad[64];
51  unsigned char opad[64];
52 }
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
64 void sha1_starts( sha1_context *ctx );
65 
73 void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
74 
81 void sha1_finish( sha1_context *ctx, unsigned char output[20] );
82 
90 void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] );
91 
100 int sha1_file( const char *path, unsigned char output[20] );
101 
109 void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen );
110 
118 void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
119 
126 void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
127 
133 void sha1_hmac_reset( sha1_context *ctx );
134 
144 void sha1_hmac( const unsigned char *key, size_t keylen,
145  const unsigned char *input, size_t ilen,
146  unsigned char output[20] );
147 
153 int sha1_self_test( int verbose );
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif /* sha1.h */