CVS update: php3/functions

From: Date: Sat, 05 Sep 1998 04:23:52 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-813@lists.php.net to get a copy of this message
Date: Saturday September 5, 1998 @ 0:23 Author: rasmus Update of /repository/php3/functions In directory asf:/export/home/rasmus/php3/functions Modified Files: md5.c Log Message: Make md5() binary safe. Had to give up on using the Apache version here since it also wasn't binary safe. We are now using our own md5() for both CGI and module builds which is where we were heading in 3.1 anyway. Index: php3/functions/md5.c diff -c php3/functions/md5.c:1.28 php3/functions/md5.c:1.29 *** php3/functions/md5.c:1.28 Fri May 15 06:57:27 1998 --- php3/functions/md5.c Sat Sep 5 00:23:52 1998 *************** *** 24,30 **** | contact core@php.net. | +----------------------------------------------------------------------+ | Authors: Lachlan Roche | - | | +----------------------------------------------------------------------+ */ --- 24,29 ---- *************** *** 39,61 **** #include "php.h" #include "internal_functions.h" - #if APACHE - #include <util_md5.h> - #else #include "md5.h" - #endif void php3_md5(INTERNAL_FUNCTION_PARAMETERS) { pval *arg; char md5str[33]; - #if (!APACHE) PHP3_MD5_CTX context; - unsigned int len; unsigned char digest[16]; int i; char *r; - #endif TLS_VARS; if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { --- 38,53 ---- *************** *** 63,89 **** } convert_to_string(arg); - #if APACHE - #if MODULE_MAGIC_NUMBER > 19970901 - strcpy(md5str, ap_md5(GLOBAL(php3_rqst)->pool, arg->value.str.val)); - #else - strcpy(md5str, md5(GLOBAL(php3_rqst)->pool, arg->value.str.val)); - #endif - #else - len = strlen(arg->value.str.val); md5str[0] = '\0'; PHP3_MD5Init(&context); ! PHP3_MD5Update(&context, arg->value.str.val, len); PHP3_MD5Final(digest, &context); for (i = 0, r = md5str; i < 16; i++, r += 2) { sprintf(r, "%02x", digest[i]); } *r = '\0'; - #endif RETVAL_STRING(md5str,1); } - #if (!APACHE) /* * The remaining code is the reference MD5 code (md5c.c) from rfc1321 */ --- 55,71 ---- } convert_to_string(arg); md5str[0] = '\0'; PHP3_MD5Init(&context); ! PHP3_MD5Update(&context, arg->value.str.val, arg->value.str.len); PHP3_MD5Final(digest, &context); for (i = 0, r = md5str; i < 16; i++, r += 2) { sprintf(r, "%02x", digest[i]); } *r = '\0'; RETVAL_STRING(md5str,1); } /* * The remaining code is the reference MD5 code (md5c.c) from rfc1321 */ *************** *** 414,421 **** for (i = 0; i < len; i++) ((char *) output)[i] = (char) value; } - - #endif /* * Local variables: --- 396,401 ---- -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#813) next »