CVS update: php3/functions

From: Date: Tue, 22 Sep 1998 03:02:37 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-1349@lists.php.net to get a copy of this message
Date: Monday September 21, 1998 @ 23:02 Author: rasmus Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv6779/functions Modified Files: crypt.c Log Message: Don't test crypt function unless crypt function is actually found. Start crypt() work Index: php3/functions/crypt.c diff -c php3/functions/crypt.c:1.36 php3/functions/crypt.c:1.37 *** php3/functions/crypt.c:1.36 Fri Sep 18 13:04:15 1998 --- php3/functions/crypt.c Mon Sep 21 23:02:36 1998 *************** *** 23,32 **** | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Authors: Stig Bakken | +----------------------------------------------------------------------+ */ ! /* $Id: crypt.c,v 1.36 1998/09/18 17:04:15 zeev Exp $ */ #include "php.h" #include "internal_functions.h" --- 23,34 ---- | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Authors: Stig Bakken <ssb@gaurdian.no> | ! | Zeev Suraski <zeev@php.net> | ! | Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: crypt.c,v 1.37 1998/09/22 03:02:36 rasmus Exp $ */ #include "php.h" #include "internal_functions.h" *************** *** 66,71 **** --- 68,91 ---- "Crypt", crypt_functions, NULL, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES }; + + /* + The capabilities of the crypt() function is determined by the test programs + run by configure from aclocal.m4. They will set PHP3_STD_DES_CRYPT, + PHP3_EXT_DES-CRYPT, PHP3_MD5_CRYPT and PHP3_BLOWFISH_CRYPT as appropriate + for the target platform + */ + + static unsigned char itoa64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + + void php3i_to64(char *s, long v, int n) { + while (--n >= 0) { + *s++ = itoa64[v&0x3f]; + v >>= 6;+ + } + } + + void php3_crypt(INTERNAL_FUNCTION_PARAMETERS) { char salt[3] = { '\0', '\0', '\0' }; *************** *** 92,97 **** --- 112,123 ---- } convert_to_string(arg1); + #if 0 + /* work in progress */ + to64(&salt[0], arc4random(), 2); + salt[2] = '\0'; + #endif + srand(time(0) * getpid()); if (!salt[0]) { *************** *** 104,110 **** salt[2] = '\0'; return_value->value.str.val = (char *) crypt(arg1->value.str.val, salt); ! return_value->value.str.len = strlen(return_value->value.str.val); /* can be optimized away to 13? */ return_value->type = IS_STRING; pval_copy_constructor(return_value); } --- 130,136 ---- salt[2] = '\0'; return_value->value.str.val = (char *) crypt(arg1->value.str.val, salt); ! return_value->value.str.len = strlen(return_value->value.str.val); return_value->type = IS_STRING; pval_copy_constructor(return_value); } -- 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 (#1349) next »