Back to index

php5  5.3.10
php_hash_md.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Original Author: Rasmus Lerdorf <rasmus@lerdorf.on.ca>               |
00016    | Modified for pHASH by: Sara Golemon <pollita@php.net>
00017    +----------------------------------------------------------------------+
00018 */
00019 
00020 /* $Id: php_hash_md.h 321634 2012-01-01 13:15:04Z felipe $ */
00021 
00022 #ifndef PHP_HASH_MD_H
00023 #define PHP_HASH_MD_H
00024 
00025 /* When SHA is removed from Core,
00026     the ext/standard/sha1.c file can be removed
00027     and the ext/standard/sha1.h file can be reduced to:
00028         #define PHP_HASH_SHA1_NOT_IN_CORE
00029         #include "ext/hash/php_hash_sha.h"
00030        Don't forget to remove md5() and md5_file() entries from basic_functions.c
00031  */
00032 
00033 #include "ext/standard/md5.h"
00034 
00035 #ifdef PHP_HASH_MD5_NOT_IN_CORE
00036 /* MD5.H - header file for MD5C.C
00037  */
00038 
00039 /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
00040    rights reserved.
00041 
00042    License to copy and use this software is granted provided that it
00043    is identified as the "RSA Data Security, Inc. MD5 Message-Digest
00044    Algorithm" in all material mentioning or referencing this software
00045    or this function.
00046 
00047    License is also granted to make and use derivative works provided
00048    that such works are identified as "derived from the RSA Data
00049    Security, Inc. MD5 Message-Digest Algorithm" in all material
00050    mentioning or referencing the derived work.
00051 
00052    RSA Data Security, Inc. makes no representations concerning either
00053    the merchantability of this software or the suitability of this
00054    software for any particular purpose. It is provided "as is"
00055    without express or implied warranty of any kind.
00056 
00057    These notices must be retained in any copies of any part of this
00058    documentation and/or software.
00059  */
00060 
00061 /* MD5 context. */
00062 typedef struct {
00063        php_hash_uint32 state[4];                        /* state (ABCD) */
00064        php_hash_uint32 count[2];                        /* number of bits, modulo 2^64 (lsb first) */
00065        unsigned char buffer[64];   /* input buffer */
00066 } PHP_MD5_CTX;
00067 
00068 PHP_HASH_API void make_digest(char *md5str, unsigned char *digest);
00069 PHP_HASH_API void PHP_MD5Init(PHP_MD5_CTX *);
00070 PHP_HASH_API void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int);
00071 PHP_HASH_API void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
00072 
00073 PHP_NAMED_FUNCTION(php_if_md5);
00074 PHP_NAMED_FUNCTION(php_if_md5_file);
00075 #endif /* PHP_HASH_MD5_NOT_IN_CORE */
00076 
00077 /* MD4 context */
00078 typedef struct {
00079        php_hash_uint32 state[4];
00080        php_hash_uint32 count[2];
00081        unsigned char buffer[64];
00082 } PHP_MD4_CTX;
00083 
00084 PHP_HASH_API void PHP_MD4Init(PHP_MD4_CTX *);
00085 PHP_HASH_API void PHP_MD4Update(PHP_MD4_CTX *context, const unsigned char *, unsigned int);
00086 PHP_HASH_API void PHP_MD4Final(unsigned char[16], PHP_MD4_CTX *);
00087 
00088 /* MD2 context */
00089 typedef struct {
00090        unsigned char state[48];
00091        unsigned char checksum[16];
00092        unsigned char buffer[16];
00093        char in_buffer;
00094 } PHP_MD2_CTX;
00095 
00096 PHP_HASH_API void PHP_MD2Init(PHP_MD2_CTX *context);
00097 PHP_HASH_API void PHP_MD2Update(PHP_MD2_CTX *context, const unsigned char *, unsigned int);
00098 PHP_HASH_API void PHP_MD2Final(unsigned char[16], PHP_MD2_CTX *);
00099 
00100 #endif