CUBRID Engine  latest
sha1.h
Go to the documentation of this file.
1 /*
2  * sha1.h
3  *
4  * Copyright (C) 1998
5  * Paul E. Jones <paulej@arid.us>
6  * All Rights Reserved
7  *
8  *****************************************************************************
9  * $Id: sha1.h,v 1.2 2004/03/27 18:00:33 paulej Exp $
10  *****************************************************************************
11  *
12  * Description:
13  * This class implements the Secure Hashing Standard as defined
14  * in FIPS PUB 180-1 published April 17, 1995.
15  *
16  * Many of the variable names in the SHA1Context, especially the
17  * single character names, were used because those were the names
18  * used in the publication.
19  *
20  * Please read the file sha1.c for more information.
21  *
22  */
23 
24 #ifndef _SHA1_H_
25 #define _SHA1_H_
26 
27 #include "system.h"
28 
29 /*
30  * This structure will hold context information for the hashing
31  * operation
32  */
33 typedef struct SHA1Context
34 {
35  unsigned Message_Digest[5]; /* Message Digest (output) */
36 
37  unsigned Length_Low; /* Message length in bits */
38  unsigned Length_High; /* Message length in bits */
39 
40  unsigned char Message_Block[64]; /* 512-bit message blocks */
41  int Message_Block_Index; /* Index into message block array */
42 
43  int Computed; /* Is the digest computed? */
44  int Corrupted; /* Is the message digest corrupted? */
45 } SHA1Context;
46 
47 /*
48  * This structure holds the hash (message digest) computed using SHA-1.
49  */
50 typedef struct SHA1Hash
51 {
52  INT32 h[5];
53 } SHA1Hash;
54 #define SHA1_HASH_INITIALIZER { { 0, 0, 0, 0, 0 } }
55 
56 #define SHA1_AS_ARGS(sha1) (sha1)->h[0], (sha1)->h[1], (sha1)->h[2], (sha1)->h[3], (sha1)->h[4]
57 
58 /*
59  * Function Prototypes
60  */
61 void SHA1Reset (SHA1Context *);
62 int SHA1Result (SHA1Context *);
63 void SHA1Input (SHA1Context *, const unsigned char *, size_t);
64 
65 int SHA1Compute (const unsigned char *, size_t, SHA1Hash *);
66 int SHA1Compare (void *a, void *b);
67 
68 #endif
Definition: sha1.h:50
unsigned Message_Digest[5]
Definition: sha1.h:35
struct SHA1Context SHA1Context
void SHA1Input(SHA1Context *, const unsigned char *, size_t)
Definition: sha1.c:149
void SHA1Reset(SHA1Context *)
Definition: sha1.c:75
unsigned Length_Low
Definition: sha1.h:37
int Computed
Definition: sha1.h:43
int SHA1Result(SHA1Context *)
Definition: sha1.c:109
struct SHA1Hash SHA1Hash
int Corrupted
Definition: sha1.h:44
int Message_Block_Index
Definition: sha1.h:41
unsigned char Message_Block[64]
Definition: sha1.h:40
int SHA1Compare(void *a, void *b)
Definition: sha1.c:400
unsigned Length_High
Definition: sha1.h:38
int SHA1Compute(const unsigned char *, size_t, SHA1Hash *)
Definition: sha1.c:372