]> git.ipfire.org Git - people/stevee/aiccu.git/blame - common/hash_sha1.h
spelling error
[people/stevee/aiccu.git] / common / hash_sha1.h
CommitLineData
d98f6a46
SS
1/*
2 * sha.h
3 *
4 * Originally taken from the public domain SHA1 implementation
5 * written by by Steve Reid <steve@edmweb.com>
6 *
7 * Modified by Aaron D. Gifford <agifford@infowest.com>
8 *
9 * NO COPYRIGHT - THIS IS 100% IN THE PUBLIC DOMAIN
10 *
11 * The original unmodified version is available at:
12 * ftp://ftp.funet.fi/pub/crypt/hash/sha/sha1.c
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef __SHA1_H__
28#define __SHA1_H__
29
30#include "common.h"
31
32/* Define this if your machine is LITTLE_ENDIAN, otherwise #undef it: */
33/* Is defined in endian.h */
34/*
35#define LITTLE_ENDIAN
36 */
37
38/* Make sure you define these types for your architecture: */
39typedef uint32_t sha1_quadbyte; /* 4 byte type */
40typedef uint8_t sha1_byte; /* single byte type */
41
42/*
43 * Be sure to get the above definitions right. For instance, on my
44 * x86 based FreeBSD box, I define LITTLE_ENDIAN and use the type
45 * "unsigned long" for the quadbyte. On FreeBSD on the Alpha, however,
46 * while I still use LITTLE_ENDIAN, I must define the quadbyte type
47 * as "unsigned int" instead.
48 */
49
50#define SHA1_BLOCK_LENGTH 64
51#define SHA1_DIGEST_LENGTH 20
52
53/* The SHA1 structure: */
54typedef struct _SHA_CTX {
55 sha1_quadbyte state[5];
56 sha1_quadbyte count[2];
57 sha1_byte buffer[SHA1_BLOCK_LENGTH];
58} SHA_CTX;
59
60#ifndef NOPROTO
61void SHA1_Init(SHA_CTX *context);
62void SHA1_Update(SHA_CTX *context, const sha1_byte *data, unsigned int len);
63void SHA1_Final(sha1_byte digest[SHA1_DIGEST_LENGTH], SHA_CTX* context);
64#else
65void SHA1_Init();
66void SHA1_Update();
67void SHA1_Final();
68#endif
69
70#endif
71