cctools
|
00001 /* 00002 Copyright (C) 2008- The University of Notre Dame 00003 This software is distributed under the GNU General Public License. 00004 See the file COPYING for details. 00005 */ 00006 00007 #ifndef SHA1_H 00008 #define SHA1_H 00009 00014 #include "int_sizes.h" 00015 00016 #define SHA1_DIGEST_LENGTH 20 00017 #define SHA1_DIGEST_ASCII_LENGTH 42 00018 00019 typedef struct { 00020 UINT32_T digest[5]; 00021 UINT32_T countLo, countHi; 00022 UINT32_T data[16]; 00023 int Endianness; 00024 } sha1_context_t; 00025 00026 void sha1_init(sha1_context_t * ctx); 00027 void sha1_update(sha1_context_t * ctx, const unsigned char *, unsigned int); 00028 void sha1_final(unsigned char digest[SHA1_DIGEST_LENGTH], sha1_context_t * ctx); 00029 00038 void sha1_buffer(const char *buffer, int length, unsigned char digest[SHA1_DIGEST_LENGTH]); 00039 00048 int sha1_file(const char *filename, unsigned char digest[SHA1_DIGEST_LENGTH]); 00049 00055 const char *sha1_string(unsigned char digest[SHA1_DIGEST_LENGTH]); 00056 00057 #endif