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

Generated on 13 Dec 2016 for cctools by  doxygen 1.6.1