sha1.h

Go to the documentation of this file.
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 /* When linking with libcvmfs, we have a name clash with functions of similar purpose.  Redefine the names here to protect our namespace. */
00015 
00016 #define sha1_init    dttools_sha1_init
00017 #define sha1_update  dttools_sha1_update
00018 #define sha1_final   dttools_sha1_final
00019 #define sha1_buffer  dttools_sha1_buffer
00020 #define sha1_file    dttools_sha1_file
00021 #define sha1_string  dttools_sha1_string
00022 
00023 #include "int_sizes.h"
00024 
00025 #define SHA1_DIGEST_LENGTH 20
00026 #define SHA1_DIGEST_ASCII_LENGTH 42
00027 
00028 typedef struct {
00029         UINT32_T digest[5];
00030         UINT32_T countLo, countHi;
00031         UINT32_T data[16];
00032         int Endianness;
00033 } sha1_context_t;
00034 
00035 void sha1_init(sha1_context_t * ctx);
00036 void sha1_update(sha1_context_t * ctx, const unsigned char *, unsigned int);
00037 void sha1_final(unsigned char digest[SHA1_DIGEST_LENGTH], sha1_context_t * ctx);
00038 
00047 void sha1_buffer(const char *buffer, int length, unsigned char digest[SHA1_DIGEST_LENGTH]);
00048 
00057 int sha1_file(const char *filename, unsigned char digest[SHA1_DIGEST_LENGTH]);
00058 
00064 const char *sha1_string(unsigned char digest[SHA1_DIGEST_LENGTH]);
00065 
00066 #endif