BeeCrypt  4.2.1
sha1.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1997, 1998, 1999, 2000, 2002 X-Way Rights BV
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
26 #ifndef _SHA1_H
27 #define _SHA1_H
28 
29 #include "beecrypt/beecrypt.h"
30 #include "beecrypt/sha1opt.h"
31 
35 #ifdef __cplusplus
37 #else
38 struct _sha1Param
39 #endif
40 {
43  uint32_t h[5];
46  uint32_t data[80];
51  #if (MP_WBITS == 64)
52  mpw length[1];
53  #elif (MP_WBITS == 32)
54  mpw length[2];
55  #else
56  # error
57  #endif
58 
62  uint32_t offset;
63 };
64 
65 #ifndef __cplusplus
66 typedef struct _sha1Param sha1Param;
67 #endif
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
76 extern BEECRYPTAPI const hashFunction sha1;
77 
84 void sha1Process(sha1Param* sp);
85 
93 int sha1Reset (sha1Param* sp);
94 
104 int sha1Update (sha1Param* sp, const byte* data, size_t size);
105 
114 int sha1Digest (sha1Param* sp, byte* digest);
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif