Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

sha1.h

Go to the documentation of this file.
00001 /*
00002  * $Id: sha1.h,v 1.3 2005/06/25 01:37:43 daichik Exp $
00003  *
00004  * This file comes from RFC 3174. Inclusion in gtk-gnutella is:
00005  *
00006  *   Copyright (c) 2002-2003, Raphael Manfredi
00007  *
00008  *----------------------------------------------------------------------
00009  * This file is part of gtk-gnutella.
00010  *
00011  *  gtk-gnutella is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version.
00015  *
00016  *  gtk-gnutella is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU General Public License for more details.
00020  *
00021  *  You should have received a copy of the GNU General Public License
00022  *  along with gtk-gnutella; if not, write to the Free Software
00023  *  Foundation, Inc.:
00024  *      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *----------------------------------------------------------------------
00026  */
00027 
00028 #ifndef _sha1_h_
00029 #define _sha1_h_
00030 
00031 #include <glib.h>
00032 
00033 /*
00034  * If you do not have the ISO standard stdint.h header file, then you
00035  * must typdef the following:
00036  *
00037  *  name            meaning
00038  *  guint32         unsigned 32 bit integer
00039  *  guint8          unsigned 8 bit integer (i.e., unsigned char)
00040  *  gint            integer of >= 16 bits
00041  *
00042  */
00043 
00044 #ifndef _SHA_enum_
00045 #define _SHA_enum_
00046 enum
00047 {
00048     shaSuccess = 0,
00049     shaNull,            
00050     shaInputTooLong,    
00051     shaStateError       
00052 };
00053 #endif
00054 #define SHA1HashSize 20
00055 
00060 typedef struct SHA1Context
00061 {
00062     guint32 Intermediate_Hash[SHA1HashSize/4]; /* Message Digest  */
00063 
00064     guint32 Length_Low;            /* Message length in bits      */
00065     guint32 Length_High;           /* Message length in bits      */
00066 
00067                               /* Index into message block array   */
00068     gint Message_Block_Index;
00069     guint8 Message_Block[64];      /* 512-bit message blocks      */
00070 
00071     int Computed;              /* Is the digest computed?         */
00072     int Corrupted;            /* Is the message digest corrupted? */
00073 } SHA1Context;
00074 
00075 /*
00076  *  Function Prototypes
00077  */
00078 
00079 
00080 int SHA1Reset(  SHA1Context *);
00081 int SHA1Input(  SHA1Context *,
00082                 const guint8 *,
00083                 unsigned int);
00084 int SHA1Result( SHA1Context *,
00085                 guint8 Message_Digest[SHA1HashSize]);
00086 
00087 #endif /* _sha1_h_ */
00088 

Generated on Sun Feb 12 10:49:57 2006 for Gtk-Gnutella by doxygen 1.3.6