resetting manifest requested domain to floor
[platform/upstream/cdrkit.git] / icedax / sha.h
1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12
13 /* @(#)sha.h    1.4 03/06/28 Copyright 1998,1999 Heiko Eissfeldt */
14 /*____________________________________________________________________________
15 //
16 //   CD Index - The Internet CD Index
17 //
18 //   This program is free software; you can redistribute it and/or modify
19 //   it under the terms of the GNU General Public License as published by
20 //   the Free Software Foundation; either version 2 of the License, or
21 //   (at your option) any later version.
22 //
23 //   This program is distributed in the hope that it will be useful,
24 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
25 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 //   GNU General Public License for more details.
27 //
28 //   You should have received a copy of the GNU General Public License
29 //   along with this program; if not, write to the Free Software
30 //   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 //
32 //   $Id: sha.h,v 1.1.1.2 1999/04/29 00:53:34 marc Exp $
33 //____________________________________________________________________________
34 */
35 #ifndef SHA_H
36 #define SHA_H
37
38 /* NIST Secure Hash Algorithm */
39 /* heavily modified by Uwe Hollerbach <uh@alumni.caltech edu> */
40 /* from Peter C. Gutmann's implementation as found in */
41 /* Applied Cryptography by Bruce Schneier */
42
43 /* This code is in the public domain */
44
45 /* Useful defines & typedefs */
46
47 typedef unsigned char BYTE;     /* 8-bit quantity */
48 typedef unsigned long ULONG;    /* 32-or-more-bit quantity */
49
50 #define SHA_BLOCKSIZE           64
51 #define SHA_DIGESTSIZE          20
52
53 typedef struct {
54     ULONG digest[5];            /* message digest */
55     ULONG count_lo, count_hi;   /* 64-bit bit count */
56     BYTE data[SHA_BLOCKSIZE];   /* SHA data buffer */
57     int local;                  /* unprocessed amount in data */
58 } SHA_INFO;
59
60 void sha_init(SHA_INFO *);
61 void sha_update(SHA_INFO *, BYTE *, int);
62 void sha_final(unsigned char [20], SHA_INFO *);
63
64 #ifdef SHA_FOR_C
65
66 #include <mconfig.h>
67 #include <stdxlib.h>
68 #include <stdio.h>
69
70 void sha_stream(unsigned char [20], SHA_INFO *, FILE *);
71 void sha_print(unsigned char [20]);
72 char *sha_version(void);
73 #endif /* SHA_FOR_C */
74
75 #define SHA_VERSION 1
76
77 #ifndef WIN32 
78 #ifdef WORDS_BIGENDIAN
79 #  if SIZEOF_UNSIGNED_LONG_INT == 4
80 #    define SHA_BYTE_ORDER  4321
81 #  else
82 #    if SIZEOF_UNSIGNED_LONG_INT == 8
83 #      define SHA_BYTE_ORDER  87654321
84 #    endif
85 #  endif
86 #else
87 #  if SIZEOF_UNSIGNED_LONG_INT == 4
88 #    define SHA_BYTE_ORDER  1234
89 #  else
90 #    if SIZEOF_UNSIGNED_LONG_INT == 8
91 #      define SHA_BYTE_ORDER  12345678
92 #    endif
93 #  endif
94 #endif
95
96 #else
97
98 #define SHA_BYTE_ORDER 1234
99
100 #endif
101
102 #endif /* SHA_H */