Re: [PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/

2008-08-17 Thread Jani Taskinen

Pierre Joye kirjoitti:

Hi,

On Sat, Aug 16, 2008 at 11:56 PM, Jani Taskinen [EMAIL PROTECTED] wrote:


Will $PHP_MHASH ever be anything here?
afaict ext/hash cannot be disabled after this change

-Hannes


I wasn't paying attention to this..what was done for ext/mhash/config.m4? :)
And == is not correct. It's just one = in m4.

Anyway, IMO, you could simply move ext/mhash/*mhash.* (.c and .h files :) to
ext/hash and simply include them with the hash sources. There's really no
need anymore for the extra directory.


The idea behind keeping mhash was to allow:

if (extension_loaded('mhash'))

I did not not test the current version but what Jani suggests should
work. You can have two extension(..) in config.* (we do it for OCI8
with oci8_11g and oci8).


You don't need to have multiple PHP_NEW_EXTENSION lines in config*.m4's to 
enable multiple extensions and is not really useful either since you break the 
ext_shared stuff, etc. If you do that anywhere, you're doing something wrong.


--Jani

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/

2008-08-17 Thread Pierre Joye
hi,

On Sun, Aug 17, 2008 at 2:09 PM, Jani Taskinen [EMAIL PROTECTED] wrote:

 You don't need to have multiple PHP_NEW_EXTENSION lines in config*.m4's to
 enable multiple extensions and is not really useful either since you break
 the ext_shared stuff, etc. If you do that anywhere, you're doing something
 wrong.

I was not saying that, I only stated why the other ext has been kept.
If you can do it in a clean(er) way, please go ahead :)

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/

2008-08-17 Thread Jani Taskinen

Pierre Joye kirjoitti:

hi,

On Sun, Aug 17, 2008 at 2:09 PM, Jani Taskinen [EMAIL PROTECTED] wrote:


You don't need to have multiple PHP_NEW_EXTENSION lines in config*.m4's to
enable multiple extensions and is not really useful either since you break
the ext_shared stuff, etc. If you do that anywhere, you're doing something
wrong.


I was not saying that, I only stated why the other ext has been kept.
If you can do it in a clean(er) way, please go ahead :)

Cheers,


It's simply ridiculous to keep a dummy extension JUST that someone can do 
extension_exists(mhash)..


--Jani


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/

2008-08-17 Thread Pierre Joye
On Sun, Aug 17, 2008 at 9:26 PM, Jani Taskinen [EMAIL PROTECTED] wrote:
 Pierre Joye kirjoitti:

 hi,

 On Sun, Aug 17, 2008 at 2:09 PM, Jani Taskinen [EMAIL PROTECTED]
 wrote:

 You don't need to have multiple PHP_NEW_EXTENSION lines in config*.m4's
 to
 enable multiple extensions and is not really useful either since you
 break
 the ext_shared stuff, etc. If you do that anywhere, you're doing
 something
 wrong.

 I was not saying that, I only stated why the other ext has been kept.
 If you can do it in a clean(er) way, please go ahead :)

 Cheers,

 It's simply ridiculous to keep a dummy extension JUST that someone can do
 extension_exists(mhash)..

I agree, but you know my opinion about such BC decision :)

-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/

2008-08-16 Thread Hannes Magnusson
2008/6/28 Scott MacVicar [EMAIL PROTECTED]:
 scottmacSat Jun 28 15:20:49 2008 UTC

  Removed files:
/php-src/ext/mhash  mhash.dsp
/php-src/ext/mhash/tests001.phpt 002.phpt 003.phpt skip.inc

  Modified files:
/php-src/ext/hash   CREDITS config.m4 hash.c
/php-src/ext/hash/tests mhash_001.phpt mhash_002.phpt
mhash_003.phpt skip_mhash.inc
/php-src/ext/mhash  config.m4 mhash.c php_mhash.h
  Log:
  MFB: Make the old mhash API a wrapper around hash, this removes a dependency.

+++ php-src/ext/hash/config.m4  Sat Jun 28 15:20:49 2008
@@ -1,9 +1,17 @@
-dnl $Id: config.m4,v 1.12 2007/07/03 17:24:36 sniper Exp $
+dnl $Id: config.m4,v 1.13 2008/06/28 15:20:49 scottmac Exp $
 dnl config.m4 for extension hash

 PHP_ARG_ENABLE(hash, whether to enable hash support,
 [  --disable-hash  Disable hash support], yes)

+if test $PHP_MHASH != no; then
+  if test $PHP_HASH == no; then
+PHP_HASH=yes
+  fi
+
+  AC_DEFINE(PHP_MHASH_BC, 1, [ ])
+fi
+


Will $PHP_MHASH ever be anything here?
afaict ext/hash cannot be disabled after this change

-Hannes

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/

2008-08-16 Thread Jani Taskinen

Hannes Magnusson kirjoitti:

2008/6/28 Scott MacVicar [EMAIL PROTECTED]:

scottmacSat Jun 28 15:20:49 2008 UTC

 Removed files:
   /php-src/ext/mhash  mhash.dsp
   /php-src/ext/mhash/tests001.phpt 002.phpt 003.phpt skip.inc

 Modified files:
   /php-src/ext/hash   CREDITS config.m4 hash.c
   /php-src/ext/hash/tests mhash_001.phpt mhash_002.phpt
   mhash_003.phpt skip_mhash.inc
   /php-src/ext/mhash  config.m4 mhash.c php_mhash.h
 Log:
 MFB: Make the old mhash API a wrapper around hash, this removes a dependency.


+++ php-src/ext/hash/config.m4  Sat Jun 28 15:20:49 2008
@@ -1,9 +1,17 @@
-dnl $Id: config.m4,v 1.12 2007/07/03 17:24:36 sniper Exp $
+dnl $Id: config.m4,v 1.13 2008/06/28 15:20:49 scottmac Exp $
 dnl config.m4 for extension hash

 PHP_ARG_ENABLE(hash, whether to enable hash support,
 [  --disable-hash  Disable hash support], yes)

+if test $PHP_MHASH != no; then
+  if test $PHP_HASH == no; then
+PHP_HASH=yes
+  fi
+
+  AC_DEFINE(PHP_MHASH_BC, 1, [ ])
+fi
+


Will $PHP_MHASH ever be anything here?
afaict ext/hash cannot be disabled after this change

-Hannes



I wasn't paying attention to this..what was done for ext/mhash/config.m4? :)
And == is not correct. It's just one = in m4.

Anyway, IMO, you could simply move ext/mhash/*mhash.* (.c and .h files :) to 
ext/hash and simply include them with the hash sources. There's really no need 
anymore for the extra directory.


--Jani


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/

2008-08-16 Thread Pierre Joye
Hi,

On Sat, Aug 16, 2008 at 11:56 PM, Jani Taskinen [EMAIL PROTECTED] wrote:

 Will $PHP_MHASH ever be anything here?
 afaict ext/hash cannot be disabled after this change

 -Hannes


 I wasn't paying attention to this..what was done for ext/mhash/config.m4? :)
 And == is not correct. It's just one = in m4.

 Anyway, IMO, you could simply move ext/mhash/*mhash.* (.c and .h files :) to
 ext/hash and simply include them with the hash sources. There's really no
 need anymore for the extra directory.

The idea behind keeping mhash was to allow:

if (extension_loaded('mhash'))

I did not not test the current version but what Jani suggests should
work. You can have two extension(..) in config.* (we do it for OCI8
with oci8_11g and oci8).

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/

2008-08-16 Thread Scott MacVicar


On 16 Aug 2008, at 17:19, Pierre Joye wrote:


Hi,

On Sat, Aug 16, 2008 at 11:56 PM, Jani Taskinen  
[EMAIL PROTECTED] wrote:



Will $PHP_MHASH ever be anything here?
afaict ext/hash cannot be disabled after this change

-Hannes



I wasn't paying attention to this..what was done for ext/mhash/ 
config.m4? :)

And == is not correct. It's just one = in m4.

Anyway, IMO, you could simply move ext/mhash/*mhash.* (.c and .h  
files :) to
ext/hash and simply include them with the hash sources. There's  
really no

need anymore for the extra directory.


The idea behind keeping mhash was to allow:

if (extension_loaded('mhash'))

I did not not test the current version but what Jani suggests should
work. You can have two extension(..) in config.* (we do it for OCI8
with oci8_11g and oci8).


I'm on vacation for the next week and a half with minimal access so if  
someone wants to make that change its fine with me.


Scott

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/hash CREDITS config.m4 hash.c /ext/hash/tests mhash_001.phpt mhash_002.phpt mhash_003.phpt skip_mhash.inc /ext/mhash config.m4 mhash.c mhash.dsp php_mhash.h /ext/mhash/t

2008-06-28 Thread Scott MacVicar
scottmacSat Jun 28 15:20:49 2008 UTC

  Removed files:   
/php-src/ext/mhash  mhash.dsp 
/php-src/ext/mhash/tests001.phpt 002.phpt 003.phpt skip.inc 

  Modified files:  
/php-src/ext/hash   CREDITS config.m4 hash.c 
/php-src/ext/hash/tests mhash_001.phpt mhash_002.phpt 
mhash_003.phpt skip_mhash.inc 
/php-src/ext/mhash  config.m4 mhash.c php_mhash.h 
  Log:
  MFB: Make the old mhash API a wrapper around hash, this removes a dependency.
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/hash/CREDITS?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/hash/CREDITS
diff -u php-src/ext/hash/CREDITS:1.2 php-src/ext/hash/CREDITS:1.3
--- php-src/ext/hash/CREDITS:1.2Fri Nov 25 18:24:32 2005
+++ php-src/ext/hash/CREDITSSat Jun 28 15:20:49 2008
@@ -1,2 +1,2 @@
 PHP hash
-Sara Golemon, Rasmus Lerdorf, Stefan Esser, Michael Wallner
+Sara Golemon, Rasmus Lerdorf, Stefan Esser, Michael Wallner, Scott MacVicar
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/config.m4?r1=1.12r2=1.13diff_format=u
Index: php-src/ext/hash/config.m4
diff -u php-src/ext/hash/config.m4:1.12 php-src/ext/hash/config.m4:1.13
--- php-src/ext/hash/config.m4:1.12 Tue Jul  3 17:24:36 2007
+++ php-src/ext/hash/config.m4  Sat Jun 28 15:20:49 2008
@@ -1,9 +1,17 @@
-dnl $Id: config.m4,v 1.12 2007/07/03 17:24:36 sniper Exp $
+dnl $Id: config.m4,v 1.13 2008/06/28 15:20:49 scottmac Exp $
 dnl config.m4 for extension hash
 
 PHP_ARG_ENABLE(hash, whether to enable hash support,
 [  --disable-hash  Disable hash support], yes)
 
+if test $PHP_MHASH != no; then
+  if test $PHP_HASH == no; then
+PHP_HASH=yes
+  fi
+
+  AC_DEFINE(PHP_MHASH_BC, 1, [ ])
+fi
+
 if test $PHP_HASH != no; then
   AC_DEFINE(HAVE_HASH_EXT,1,[Have HASH Extension])
 
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash.c?r1=1.43r2=1.44diff_format=u
Index: php-src/ext/hash/hash.c
diff -u php-src/ext/hash/hash.c:1.43 php-src/ext/hash/hash.c:1.44
--- php-src/ext/hash/hash.c:1.43Tue Jun  3 17:27:10 2008
+++ php-src/ext/hash/hash.c Sat Jun 28 15:20:49 2008
@@ -13,10 +13,11 @@
   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
   +--+
   | Author: Sara Golemon [EMAIL PROTECTED]   |
+  | Scott MacVicar [EMAIL PROTECTED]|
   +--+
 */
 
-/* $Id: hash.c,v 1.43 2008/06/03 17:27:10 scottmac Exp $ */
+/* $Id: hash.c,v 1.44 2008/06/28 15:20:49 scottmac Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -35,6 +36,48 @@
 # define DEFAULT_CONTEXT NULL
 #endif
 
+#ifdef PHP_MHASH_BC
+struct mhash_bc_entry {
+   char *mhash_name;
+   char *hash_name;
+   int value;
+};
+
+#define MHASH_NUM_ALGOS 29
+
+static struct mhash_bc_entry mhash_to_hash[MHASH_NUM_ALGOS] = {
+   {CRC32, crc32, 0},
+   {MD5, md5, 1},
+   {SHA1, sha1, 2},
+   {HAVAL256, haval256,3, 3},
+   {NULL, NULL, 4},
+   {RIPEMD160, ripemd160, 5},
+   {NULL, NULL, 6},
+   {TIGER, tiger192,3, 7},
+   {GOST, gost, 8},
+   {CRC32B, crc32b, 9},
+   {HAVAL224, haval224,3, 10},
+   {HAVAL192, haval192,3, 11},
+   {HAVAL160, haval160,3, 12},
+   {HAVAL128, haval128,3, 13},
+   {TIGER128, tiger128,3, 14},
+   {TIGER160, tiger160,3, 15},
+   {MD4, md4, 16},
+   {SHA256, sha256, 17},
+   {ADLER32, adler32, 18},
+   {SHA224, sha224, 19},
+   {SHA512, sha512, 20},
+   {SHA384, sha384, 21},
+   {WHIRLPOOL, whirlpool, 22},
+   {RIPEMD128, ripemd128, 23},
+   {RIPEMD256, ripemd256, 24},
+   {RIPEMD320, ripemd320, 25},
+   {NULL, NULL, 26}, /* support needs to be added for snefru 128 */
+   {SNEFRU256, snefru256, 27},
+   {MD2, md2, 28}
+};
+#endif
+
 /* Hash Registry Access */
 
 PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int 
algo_len) /* {{{ */
@@ -74,12 +117,12 @@
 
 /* Userspace */
 
-static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename) /* 
{{{ */
+static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, 
zend_bool raw_output_default) /* {{{ */
 {
char *algo, *data, *digest;
int algo_len, data_len;
zend_uchar data_type = IS_STRING;
-   zend_bool raw_output = 0;
+   zend_bool raw_output = raw_output_default;
const php_hash_ops *ops;
void *context;
php_stream *stream = NULL;
@@ -175,7 +218,7 @@
 Returns lowercase hexits by default */
 PHP_FUNCTION(hash)
 {
-   php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+   php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 0);
 }
 /* }}} */
 
@@ -184,16 +227,16 @@
 Returns lowercase hexits by default */
 PHP_FUNCTION(hash_file)
 {
-   php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+