Eneboo - Documentación para desarrolladores
|
00001 /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 /* 00018 This is the header file for code which implements the Secure 00019 Hashing Algorithm 1 as defined in FIPS PUB 180-1 published 00020 April 17, 1995. 00021 00022 Many of the variable names in this code, especially the 00023 single character names, were used because those were the names 00024 used in the publication. 00025 00026 Please read the file sha1.c for more information. 00027 00028 Modified 2002 by Peter Zaitsev to better follow MySQL standards 00029 */ 00030 00031 00032 enum sha_result_codes 00033 { 00034 SHA_SUCCESS = 0, 00035 SHA_NULL, /* Null pointer parameter */ 00036 SHA_INPUT_TOO_LONG, /* input data too long */ 00037 SHA_STATE_ERROR /* called Input after Result */ 00038 }; 00039 00040 #define SHA1_HASH_SIZE 20 /* Hash size in bytes */ 00041 00042 /* 00043 This structure will hold context information for the SHA-1 00044 hashing operation 00045 */ 00046 00047 typedef struct SHA1_CONTEXT 00048 { 00049 ulonglong Length; /* Message length in bits */ 00050 uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */ 00051 int Computed; /* Is the digest computed? */ 00052 int Corrupted; /* Is the message digest corrupted? */ 00053 int16 Message_Block_Index; /* Index into message block array */ 00054 uint8 Message_Block[64]; /* 512-bit message blocks */ 00055 } SHA1_CONTEXT; 00056 00057 /* 00058 Function Prototypes 00059 */ 00060 00061 C_MODE_START 00062 00063 int sha1_reset( SHA1_CONTEXT* ); 00064 int sha1_input( SHA1_CONTEXT*, const uint8 *, unsigned int ); 00065 int sha1_result( SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE] ); 00066 00067 C_MODE_END