~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to include/sha1.h

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2002, 2006 MySQL AB
 
2
 
 
3
 This program is free software; you can redistribute it and/or modify
 
4
 it under the terms of the GNU General Public License as published by
 
5
 the Free Software Foundation; version 2 of the License.
 
6
 
 
7
 This program is distributed in the hope that it will be useful,
 
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
 GNU General Public License for more details.
 
11
 
 
12
 You should have received a copy of the GNU General Public License
 
13
 along with this program; if not, write to the Free Software
 
14
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
/*
 
17
 This is the header file for code which implements the Secure
 
18
 Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
 
19
 April 17, 1995.
 
20
 
 
21
 Many of the variable names in this code, especially the
 
22
 single character names, were used because those were the names
 
23
 used in the publication.
 
24
 
 
25
 Please read the file sha1.c for more information.
 
26
 
 
27
 Modified 2002 by Peter Zaitsev to better follow MySQL standards
 
28
*/
 
29
 
 
30
 
 
31
enum sha_result_codes
 
32
{
 
33
  SHA_SUCCESS = 0,
 
34
  SHA_NULL,             /* Null pointer parameter */
 
35
  SHA_INPUT_TOO_LONG,   /* input data too long */
 
36
  SHA_STATE_ERROR       /* called Input after Result */
 
37
};
 
38
 
 
39
#define SHA1_HASH_SIZE 20 /* Hash size in bytes */
 
40
 
 
41
/*
 
42
  This structure will hold context information for the SHA-1
 
43
  hashing operation
 
44
*/
 
45
 
 
46
typedef struct SHA1_CONTEXT
 
47
{
 
48
  ulonglong  Length;            /* Message length in bits      */
 
49
  uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest  */
 
50
  int Computed;                 /* Is the digest computed?         */
 
51
  int Corrupted;                /* Is the message digest corrupted? */
 
52
  int16 Message_Block_Index;    /* Index into message block array   */
 
53
  uint8 Message_Block[64];      /* 512-bit message blocks      */
 
54
} SHA1_CONTEXT;
 
55
 
 
56
/*
 
57
  Function Prototypes
 
58
*/
 
59
 
 
60
C_MODE_START
 
61
 
 
62
int mysql_sha1_reset(SHA1_CONTEXT*);
 
63
int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
 
64
int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
 
65
 
 
66
C_MODE_END