/[winpt]/trunk/Gnupg/md.h
ViewVC logotype

Annotation of /trunk/Gnupg/md.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Mon Jan 31 11:02:21 2005 UTC (20 years, 1 month ago) by twoaday
File MIME type: text/plain
File size: 2436 byte(s)
WinPT initial checkin.


1 twoaday 2 /* SHA256, SHA384, SHA512 Copyright 2001 by Jari Ruusu.
2     * Redistribution of this file is permitted under the GNU Public License.
3     */
4     #ifndef GPGLIB_MD_H
5     #define GPGLIB_MD_H
6    
7     /****************
8     * Rotate a 32 bit integer by n bytes
9     */
10     #define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
11    
12     #include <sys/types.h>
13    
14     typedef unsigned __int64 u_int64_t;
15     typedef unsigned __int32 u_int32_t;
16    
17     typedef struct {
18     unsigned char sha_out[64]; /* results are here, bytes 0...31 */
19     u_int32_t sha_H[8];
20     u_int64_t sha_blocks;
21     int sha_bufCnt;
22     } sha256_context;
23    
24     typedef struct {
25     unsigned char sha_out[128]; /* results are here, bytes 0...63 */
26     u_int64_t sha_H[8];
27     u_int64_t sha_blocks;
28     u_int64_t sha_blocksMSB;
29     int sha_bufCnt;
30     } sha512_context;
31    
32     typedef struct {
33     unsigned long h0,h1,h2,h3,h4;
34     unsigned long nblocks;
35     unsigned char buf[64];
36     int count;
37     } RMD160_CONTEXT;
38    
39     typedef struct {
40     unsigned long h0,h1,h2,h3,h4;
41     unsigned long nblocks;
42     unsigned char buf[64];
43     int count;
44     } SHA1_CONTEXT;
45    
46     typedef struct {
47     unsigned long A,B,C,D; /* chaining variables */
48     unsigned long nblocks;
49     unsigned char buf[64];
50     int count;
51     } MD5_CONTEXT;
52    
53    
54     unsigned char * sha1_read( SHA1_CONTEXT *hd );
55     void sha1_final( SHA1_CONTEXT *hd );
56     void sha1_write( SHA1_CONTEXT *hd, unsigned char *inbuf, size_t inlen );
57     void sha1_init( SHA1_CONTEXT *hd );
58    
59     unsigned char * md5_read( MD5_CONTEXT * hd );
60     void md5_final( MD5_CONTEXT * hd );
61     void md5_write( MD5_CONTEXT * hd, unsigned char *inbuf, size_t inlen );
62     void md5_init( MD5_CONTEXT * hd );
63    
64     unsigned char * rmd160_read( RMD160_CONTEXT *hd );
65     void rmd160_init( RMD160_CONTEXT *hd );
66     void rmd160_write( RMD160_CONTEXT *hd, unsigned char *inbuf, size_t inlen);
67     void rmd160_final( RMD160_CONTEXT *hd );
68     void rmd160_mixblock( RMD160_CONTEXT *hd, char *buffer );
69    
70     void sha256_init(sha256_context *);
71     void sha256_write(sha256_context *, unsigned char *, size_t);
72     void sha256_final(sha256_context *);
73     unsigned char * sha256_read (sha256_context *);
74    
75     void sha512_init(sha512_context *);
76     void sha512_write(sha512_context *, unsigned char *, size_t);
77     void sha512_final(sha512_context *);
78     unsigned char * sha512_read (sha512_context *);
79    
80     void sha384_init(sha512_context *);
81    
82    
83    
84     #endif /* GPGLIB_MD_H */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26