mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / include / sha1.h
blob787896e7476603d601c1ac077c7edcbe8e90d30c
1 /* Copyright (C) 2002, 2006 MySQL AB
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 This is the header file for code which implements the Secure
19 Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
20 April 17, 1995.
22 Many of the variable names in this code, especially the
23 single character names, were used because those were the names
24 used in the publication.
26 Please read the file sha1.c for more information.
28 Modified 2002 by Peter Zaitsev to better follow MySQL standards
30 Original Source from: http://www.faqs.org/rfcs/rfc3174.html
32 Copyright (C) The Internet Society (2001). All Rights Reserved.
34 This document and translations of it may be copied and furnished to
35 others, and derivative works that comment on or otherwise explain it
36 or assist in its implementation may be prepared, copied, published
37 and distributed, in whole or in part, without restriction of any
38 kind, provided that the above copyright notice and this paragraph are
39 included on all such copies and derivative works. However, this
40 document itself may not be modified in any way, such as by removing
41 the copyright notice or references to the Internet Society or other
42 Internet organizations, except as needed for the purpose of
43 developing Internet standards in which case the procedures for
44 copyrights defined in the Internet Standards process must be
45 followed, or as required to translate it into languages other than
46 English.
48 The limited permissions granted above are perpetual and will not be
49 revoked by the Internet Society or its successors or assigns.
51 This document and the information contained herein is provided on an
52 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
53 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
54 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
55 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
56 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
58 Acknowledgement
59 Funding for the RFC Editor function is currently provided by the
60 Internet Society.
64 enum sha_result_codes
66 SHA_SUCCESS = 0,
67 SHA_NULL, /* Null pointer parameter */
68 SHA_INPUT_TOO_LONG, /* input data too long */
69 SHA_STATE_ERROR /* called Input after Result */
72 #define SHA1_HASH_SIZE 20 /* Hash size in bytes */
75 This structure will hold context information for the SHA-1
76 hashing operation
79 typedef struct SHA1_CONTEXT
81 ulonglong Length; /* Message length in bits */
82 uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */
83 int Computed; /* Is the digest computed? */
84 int Corrupted; /* Is the message digest corrupted? */
85 int16 Message_Block_Index; /* Index into message block array */
86 uint8 Message_Block[64]; /* 512-bit message blocks */
87 } SHA1_CONTEXT;
90 Function Prototypes
93 C_MODE_START
95 int mysql_sha1_reset(SHA1_CONTEXT*);
96 int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
97 int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
99 C_MODE_END