00001 /* 00002 * Copyright (c) 1997, 1998, 1999, 2000, 2002 X-Way Rights BV 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 */ 00019 00026 #ifndef _SHA1_H 00027 #define _SHA1_H 00028 00029 #include "beecrypt/beecrypt.h" 00030 #include "beecrypt/sha1opt.h" 00031 00035 #ifdef __cplusplus 00036 struct BEECRYPTAPI sha1Param 00037 #else 00038 struct _sha1Param 00039 #endif 00040 { 00043 uint32_t h[5]; 00046 uint32_t data[80]; 00051 #if (MP_WBITS == 64) 00052 mpw length[1]; 00053 #elif (MP_WBITS == 32) 00054 mpw length[2]; 00055 #else 00056 # error 00057 #endif 00058 00062 uint32_t offset; 00063 }; 00064 00065 #ifndef __cplusplus 00066 typedef struct _sha1Param sha1Param; 00067 #endif 00068 00069 #ifdef __cplusplus 00070 extern "C" { 00071 #endif 00072 00076 extern BEECRYPTAPI const hashFunction sha1; 00077 00083 BEECRYPTAPI 00084 void sha1Process(sha1Param* sp); 00085 00092 BEECRYPTAPI 00093 int sha1Reset (sha1Param* sp); 00094 00103 BEECRYPTAPI 00104 int sha1Update (sha1Param* sp, const byte* data, size_t size); 00105 00113 BEECRYPTAPI 00114 int sha1Digest (sha1Param* sp, byte* digest); 00115 00116 #ifdef __cplusplus 00117 } 00118 #endif 00119 00120 #endif