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