PageRenderTime 25ms CodeModel.GetById 15ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/External/Mysql-5.0/include/sha1.h

http://awoe.googlecode.com/
C++ Header | 66 lines | 22 code | 10 blank | 34 comment | 0 complexity | 97c724bc3b9ac658e57c3ee4e0c524d5 MD5 | raw file
 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
31enum 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
46typedef 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
60C_MODE_START
61
62int mysql_sha1_reset(SHA1_CONTEXT*);
63int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
64int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
65
66C_MODE_END