tony2001 Mon Aug 18 14:33:01 2008 UTC
Modified files: (Branch: PHP_5_2)
/php-src NEWS
/php-src/ext/hash hash_crc32.c
/php-src/ext/hash/tests crc32.phpt
Log:
MFH: fix bug #45028 (CRC32 output endianness is different between crc32() and
hash())
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1200&r2=1.2027.2.547.2.1201&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1200 php-src/NEWS:1.2027.2.547.2.1201
--- php-src/NEWS:1.2027.2.547.2.1200 Mon Aug 18 04:09:37 2008
+++ php-src/NEWS Mon Aug 18 14:32:58 2008
@@ -59,6 +59,8 @@
(Dmitry)
- Fixed bug #45139 (ReflectionProperty returns incorrect declaring class).
(Felipe)
+- Fixed bug #45028 (CRC32 output endianness is different between crc32()
+ and hash()). (Tony)
- Fixed bug #45004 (pg_insert() does not accept 4 digit timezone format).
(Ilia)
- Fixed bug #44891 Memory leak using registerPHPFunctions and XSLT Variable
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_crc32.c?r1=1.2.2.3.2.3&r2=1.2.2.3.2.4&diff_format=u
Index: php-src/ext/hash/hash_crc32.c
diff -u php-src/ext/hash/hash_crc32.c:1.2.2.3.2.3
php-src/ext/hash/hash_crc32.c:1.2.2.3.2.4
--- php-src/ext/hash/hash_crc32.c:1.2.2.3.2.3 Mon Dec 31 07:20:07 2007
+++ php-src/ext/hash/hash_crc32.c Mon Aug 18 14:32:59 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hash_crc32.c,v 1.2.2.3.2.3 2007/12/31 07:20:07 sebastian Exp $ */
+/* $Id: hash_crc32.c,v 1.2.2.3.2.4 2008/08/18 14:32:59 tony2001 Exp $ */
#include "php_hash.h"
#include "php_hash_crc32.h"
@@ -56,6 +56,16 @@
context->state = 0;
}
+PHP_HASH_API void PHP_CRC32BFinal(unsigned char digest[4], PHP_CRC32_CTX
*context)
+{
+ context->state=~context->state;
+ digest[0] = (unsigned char) ((context->state >> 24) & 0xff);
+ digest[1] = (unsigned char) ((context->state >> 16) & 0xff);
+ digest[2] = (unsigned char) ((context->state >> 8) & 0xff);
+ digest[3] = (unsigned char) (context->state & 0xff);
+ context->state = 0;
+}
+
const php_hash_ops php_hash_crc32_ops = {
(php_hash_init_func_t) PHP_CRC32Init,
(php_hash_update_func_t) PHP_CRC32Update,
@@ -68,7 +78,7 @@
const php_hash_ops php_hash_crc32b_ops = {
(php_hash_init_func_t) PHP_CRC32Init,
(php_hash_update_func_t) PHP_CRC32BUpdate,
- (php_hash_final_func_t) PHP_CRC32Final,
+ (php_hash_final_func_t) PHP_CRC32BFinal,
4, /* what to say here? */
4,
sizeof(PHP_CRC32_CTX)
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/tests/crc32.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u
Index: php-src/ext/hash/tests/crc32.phpt
diff -u php-src/ext/hash/tests/crc32.phpt:1.1.2.2
php-src/ext/hash/tests/crc32.phpt:1.1.2.2.2.1
--- php-src/ext/hash/tests/crc32.phpt:1.1.2.2 Sat Dec 3 10:18:38 2005
+++ php-src/ext/hash/tests/crc32.phpt Mon Aug 18 14:33:00 2008
@@ -28,9 +28,9 @@
882174a0
96790816
00000000
-43beb7e8
-c2412435
-7f9d1520
-bd50274c
-d2e6c21f
-724aa97c
+e8b7be43
+352441c2
+20159d7f
+4c2750bd
+1fc2e6d2
+7ca94a72
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php