diff options
author | Scott MacVicar <scottmac@php.net> | 2009-06-30 13:21:53 +0000 |
---|---|---|
committer | Scott MacVicar <scottmac@php.net> | 2009-06-30 13:21:53 +0000 |
commit | 27a1ce801c6199ec9a65f31d1fcf130fad6ad4a2 (patch) | |
tree | d7ebf09033a14dd788fe8801879db05ce34d6852 /ext/hash | |
parent | ae2c5ee7d49afaf0c6ede990ff162d496c7890e4 (diff) | |
download | php-git-27a1ce801c6199ec9a65f31d1fcf130fad6ad4a2.tar.gz |
MFH Fix bug #48284 - adler32 is in the wrong order. Changed to match what zlib produces.
Diffstat (limited to 'ext/hash')
-rw-r--r-- | ext/hash/hash_adler32.c | 8 | ||||
-rw-r--r-- | ext/hash/tests/adler32.phpt | 14 | ||||
-rw-r--r-- | ext/hash/tests/hash_copy_001.phpt | 8 | ||||
-rw-r--r-- | ext/hash/tests/hash_file_basic1.phpt | 6 | ||||
-rw-r--r-- | ext/hash/tests/hash_hmac_basic.phpt | 6 | ||||
-rw-r--r-- | ext/hash/tests/hash_hmac_file_basic.phpt | 6 |
6 files changed, 24 insertions, 24 deletions
diff --git a/ext/hash/hash_adler32.c b/ext/hash/hash_adler32.c index 0533951355..08b9adcf05 100644 --- a/ext/hash/hash_adler32.c +++ b/ext/hash/hash_adler32.c @@ -42,10 +42,10 @@ PHP_HASH_API void PHP_ADLER32Update(PHP_ADLER32_CTX *context, const unsigned cha PHP_HASH_API void PHP_ADLER32Final(unsigned char digest[4], PHP_ADLER32_CTX *context) { - digest[3] = (unsigned char) ((context->state >> 24) & 0xff); - digest[2] = (unsigned char) ((context->state >> 16) & 0xff); - digest[1] = (unsigned char) ((context->state >> 8) & 0xff); - digest[0] = (unsigned char) (context->state & 0xff); + 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; } diff --git a/ext/hash/tests/adler32.phpt b/ext/hash/tests/adler32.phpt index acfcc2b278..eab2a3f1fd 100644 --- a/ext/hash/tests/adler32.phpt +++ b/ext/hash/tests/adler32.phpt @@ -13,10 +13,10 @@ echo hash('adler32', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345 echo hash('adler32', '12345678901234567890123456789012345678901234567890123456789012345678901234567890'), "\n"; ?> --EXPECT-- -01000000 -62006200 -27014d02 -86057529 -200b8690 -0c15db8a -6910b697 +00000001 +00620062 +024d0127 +29750586 +90860b20 +8adb150c +97b61069 diff --git a/ext/hash/tests/hash_copy_001.phpt b/ext/hash/tests/hash_copy_001.phpt index 5c0e8ee49b..ffc87c3a8f 100644 --- a/ext/hash/tests/hash_copy_001.phpt +++ b/ext/hash/tests/hash_copy_001.phpt @@ -71,8 +71,8 @@ string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26" string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26" string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5" string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5" -string(8) "28097c6f" -string(8) "28097c6f" +string(8) "6f7c0928" +string(8) "6f7c0928" string(8) "e5cfc160" string(8) "e5cfc160" string(8) "69147a4e" @@ -155,8 +155,8 @@ string(64) "fbe88daa74c89b9e29468fa3cd3a657d31845e21bb58dd3f8d806f5179a85c26" string(64) "614ca924864fa0e8fa309aa0944e047d5edbfd4964a35858f4d8ec66a0fb88b0" string(64) "5820c7c4a0650587538b30ef4099f2b5993069758d5c847a552e6ef7360766a5" string(64) "a00961e371287c71c527a41c14564f13b6ed12ac7cd9d5f5dfb3542a25e28d3b" -string(8) "28097c6f" -string(8) "471714d9" +string(8) "6f7c0928" +string(8) "d9141747" string(8) "e5cfc160" string(8) "59f8d3d2" string(8) "69147a4e" diff --git a/ext/hash/tests/hash_file_basic1.phpt b/ext/hash/tests/hash_file_basic1.phpt index 5a7f47603c..0e177e909a 100644 --- a/ext/hash/tests/hash_file_basic1.phpt +++ b/ext/hash/tests/hash_file_basic1.phpt @@ -61,7 +61,7 @@ unlink($file); ===Done=== --EXPECTF-- *** Testing hash_file() : basic functionality *** -adler32: 2e2287ff +adler32: ff87222e crc32: 61664d33 gost: d9e65f0c0c2ef944e4f8a01f4a46365c4f33a2853756878182a7f03e1490a4cd haval128,3: 8bb81269aca8b7f87829020d76a4e841 @@ -79,7 +79,7 @@ sha512: 1f42adaf938fbf136e381b164bae5f984c7f9fe60c82728bd889c14f187c7d63e81a0305 snefru: d414b2345d3e7fa1a31c044cf334bfc1fec24d89e464411998d579d24663895f tiger192,3: c6fa75a0be4ecf7afa3cafb4e2a08efc3a40534c0e46b971 whirlpool: 4248b149e000477269a4a5f1a84d97cfc3d0199b7aaf505913e6f010a6f83276029d11a9ad545374bc710eb59c7d958985023ab886ffa9ec9a23852844c764ec -adler32(raw): 2e2287ff +adler32(raw): ff87222e md5(raw): 704bf818448f5bbb94061332d2c889aa sha256(raw): a0f5702fa5d3670b80033d668e8732b70550392abb53841355447f8bb0f72245 -===Done===
\ No newline at end of file +===Done=== diff --git a/ext/hash/tests/hash_hmac_basic.phpt b/ext/hash/tests/hash_hmac_basic.phpt index 645135149a..801e99a313 100644 --- a/ext/hash/tests/hash_hmac_basic.phpt +++ b/ext/hash/tests/hash_hmac_basic.phpt @@ -42,7 +42,7 @@ echo "sha256(raw): " . bin2hex(hash_hmac('sha256', $content, $key, TRUE)) . "\n" ===Done=== --EXPECTF-- *** Testing hash_hmac() : basic functionality *** -adler32: 9e033311 +adler32: 12c803f7 crc32: 96859101 gost: a4a3c80bdf3f8665bf07376a34dc9c1b11af7c813f4928f62e39f0c0dc564dad haval128,3: 82cd0f4bd36729b5c80c33efa8c13ac5 @@ -60,7 +60,7 @@ sha512: 7de05636b18e2b0ca3427e03f53074af3a48a7b9df226daba4f22324c570638e7d7b2643 snefru: 67af483046f9cf16fe19f9087929ccfc6ad176ade3290b4d33f43e0ddb07e711 tiger192,3: 82779797cdc439e886884953ba21fa38e35679041e95ee27 whirlpool: 4a0f1582b21b7aff59bfba7f9c29131c69741b2ce80acdc7d314040f3b768cf5a17e30b74cceb86fbc6b34b1692e0addd5bfd7cfc043d40c0621f1b97e26fa49 -adler32(raw): 9e033311 +adler32(raw): 12c803f7 md5(raw): 2a632783e2812cf23de100d7d6a463ae sha256(raw): 49bde3496b9510a17d0edd8a4b0ac70148e32a1d51e881ec76faa96534125838 -===Done===
\ No newline at end of file +===Done=== diff --git a/ext/hash/tests/hash_hmac_file_basic.phpt b/ext/hash/tests/hash_hmac_file_basic.phpt index bd5c4137b9..c8caf71c27 100644 --- a/ext/hash/tests/hash_hmac_file_basic.phpt +++ b/ext/hash/tests/hash_hmac_file_basic.phpt @@ -70,7 +70,7 @@ unlink($file); ===Done=== --EXPECTF-- *** Testing hash_hmac_file() : basic functionality *** -adler32: 9f037811 +adler32: 0f8c02f9 crc32: f2a60b9c gost: 94c39a40d5db852a8dc3d24e37eebf2d53e3d711457c59cd02b614f792a9d918 haval128,3: e8fcff647f1a675acb429130fb94a17e @@ -88,7 +88,7 @@ sha512: d460aabdf0353655059ed0d408efa91f19c4cda46acc2a4e0adf4764b06951c899fbb2ed snefru: 7b79787e1c1d926b6cc98327f05c5d04ba6227ab51c1398661861196016ef34c tiger192,3: 5577f21e2af269fff41e023db30e2b01bfd8b8f669177929 whirlpool: 37a0fbb90547690d5e5e11c046f6654ffdb7bab15e16d9d79c7d85765cc4bdcbfd9df8db7a3ce9558f3f244fead00ca29cf05297f75596555195a0683f15d69f -adler32(raw): 9f037811 +adler32(raw): 0f8c02f9 md5(raw): 8bddf39dd1c566c27acc7fa85ec36acf sha256(raw): 9135286ca4c84dec711e4b831f6cd39e672e5ff93d011321274eb76733cc1e40 Error cases: @@ -98,4 +98,4 @@ Warning: hash_hmac_file() expects at least 3 parameters, 0 given in %s on line % Warning: hash_hmac_file() expects at least 3 parameters, 2 given in %s on line %d Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d -===Done===
\ No newline at end of file +===Done=== |