From 182995353f24c7ed1305077d436c8728cc3cc750 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Wed, 24 Apr 2013 09:01:47 -0700 Subject: [PATCH] Fix varios ext/hash algorithms Added sha224 algo (derivative of sha256) Added fnv132, fnv1a32, fnv164, fnv1a64 algos Fixed tiger* finalization (endianess was backwards) I fixed the endianness of tiger*,* and added Zend's unit tests, but I forgot to update these tests. --- hphp/runtime/ext/ext_hash.cpp | 7 +- hphp/runtime/ext/hash/hash_fnv1.cpp | 137 +++++++++++++++++++++ hphp/runtime/ext/hash/{hash_sha.h => hash_fnv1.h} | 36 ++---- hphp/runtime/ext/hash/hash_sha.cpp | 56 ++++++--- hphp/runtime/ext/hash/hash_sha.h | 13 +- hphp/runtime/ext/hash/hash_tiger.cpp | 52 ++++---- hphp/test/test_ext_hash.cpp | 76 ++++++------ hphp/test/zend/{bad => good}/ext-hash/fnv132.php | 2 +- .../zend/{bad => good}/ext-hash/fnv132.php.expectf | 0 hphp/test/zend/{bad => good}/ext-hash/fnv164.php | 2 +- .../zend/{bad => good}/ext-hash/fnv164.php.expectf | 0 hphp/test/zend/{bad => good}/ext-hash/sha224.php | 2 +- .../zend/{bad => good}/ext-hash/sha224.php.expectf | 0 hphp/test/zend/{bad => good}/ext-hash/tiger.php | 2 +- .../zend/{bad => good}/ext-hash/tiger.php.expectf | 0 15 files changed, 274 insertions(+), 111 deletions(-) create mode 100644 hphp/runtime/ext/hash/hash_fnv1.cpp copy hphp/runtime/ext/hash/{hash_sha.h => hash_fnv1.h} (68%) rename hphp/test/zend/{bad => good}/ext-hash/fnv132.php (99%) rename hphp/test/zend/{bad => good}/ext-hash/fnv132.php.expectf (100%) rename hphp/test/zend/{bad => good}/ext-hash/fnv164.php (99%) rename hphp/test/zend/{bad => good}/ext-hash/fnv164.php.expectf (100%) rename hphp/test/zend/{bad => good}/ext-hash/sha224.php (85%) rename hphp/test/zend/{bad => good}/ext-hash/sha224.php.expectf (100%) rename hphp/test/zend/{bad => good}/ext-hash/tiger.php (98%) rename hphp/test/zend/{bad => good}/ext-hash/tiger.php.expectf (100%) diff --git a/hphp/runtime/ext/ext_hash.cpp b/hphp/runtime/ext/ext_hash.cpp index 3443dc49719..b9da84b9e43 100644 --- a/hphp/runtime/ext/ext_hash.cpp +++ b/hphp/runtime/ext/ext_hash.cpp @@ -27,7 +27,7 @@ #include #include #include - +#include #include #include @@ -51,6 +51,7 @@ public: HashEngines["md4"] = HashEnginePtr(new hash_md4()); HashEngines["md5"] = HashEnginePtr(new hash_md5()); HashEngines["sha1"] = HashEnginePtr(new hash_sha1()); + HashEngines["sha224"] = HashEnginePtr(new hash_sha224()); HashEngines["sha256"] = HashEnginePtr(new hash_sha256()); HashEngines["sha384"] = HashEnginePtr(new hash_sha384()); HashEngines["sha512"] = HashEnginePtr(new hash_sha512()); @@ -85,6 +86,10 @@ public: HashEngines["haval192,5"] = HashEnginePtr(new hash_haval(5,192)); HashEngines["haval224,5"] = HashEnginePtr(new hash_haval(5,224)); HashEngines["haval256,5"] = HashEnginePtr(new hash_haval(5,256)); + HashEngines["fnv132"] = HashEnginePtr(new hash_fnv132(false)); + HashEngines["fnv1a32"] = HashEnginePtr(new hash_fnv132(true)); + HashEngines["fnv164"] = HashEnginePtr(new hash_fnv164(false)); + HashEngines["fnv1a64"] = HashEnginePtr(new hash_fnv164(true)); } }; diff --git a/hphp/runtime/ext/hash/hash_fnv1.cpp b/hphp/runtime/ext/hash/hash_fnv1.cpp new file mode 100644 index 00000000000..664d14c0b87 --- /dev/null +++ b/hphp/runtime/ext/hash/hash_fnv1.cpp @@ -0,0 +1,137 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ +*/ + +#include + +#define PHP_FNV1_32_INIT ((uint32_t)0x811c9dc5) +#define PHP_FNV_32_PRIME ((uint32_t)0x01000193) + +#define PHP_FNV1_64_INIT ((uint64_t)0xcbf29ce484222325ULL) +#define PHP_FNV_64_PRIME ((uint64_t)0x100000001b3ULL) + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + uint32_t state; +} PHP_FNV132_CTX; + +typedef struct { + uint64_t state; +} PHP_FNV164_CTX; + +hash_fnv132::hash_fnv132(bool a) + : HashEngine(4, 4, sizeof(PHP_FNV132_CTX)), m_a(a) { +} + +hash_fnv164::hash_fnv164(bool a) + : HashEngine(8, 4, sizeof(PHP_FNV164_CTX)), m_a(a) { +} + +void hash_fnv132::hash_init(void *context_) { + PHP_FNV132_CTX *context = (PHP_FNV132_CTX*)context_; + context->state = PHP_FNV1_32_INIT; +} + +void hash_fnv164::hash_init(void *context_) { + PHP_FNV164_CTX *context = (PHP_FNV164_CTX*)context_; + context->state = PHP_FNV1_64_INIT; +} + +void hash_fnv132::hash_update(void *context_, const unsigned char *input, + unsigned int len) { + PHP_FNV132_CTX *context = (PHP_FNV132_CTX*)context_; + const unsigned char *bp = (unsigned char *)input; /* start of buffer */ + const unsigned char *be = bp + len; /* beyond end of buffer */ + + /* + * FNV-1 hash each octet in the buffer + */ + while (bp < be) { + if (m_a == false) { + /* multiply by the 32 bit FNV magic prime mod 2^32 */ + context->state *= PHP_FNV_32_PRIME; + + /* xor the bottom with the current octet */ + context->state ^= (uint32_t)*bp++; + } else { + /* xor the bottom with the current octet */ + context->state ^= (uint32_t)*bp++; + + /* multiply by the 32 bit FNV magic prime mod 2^32 */ + context->state *= PHP_FNV_32_PRIME; + } + } +} + +void hash_fnv164::hash_update(void *context_, const unsigned char *input, + unsigned int len) { + PHP_FNV164_CTX *context = (PHP_FNV164_CTX*)context_; + unsigned char *bp = (unsigned char *)input; /* start of buffer */ + unsigned char *be = bp + len; /* beyond end of buffer */ + + /* + * FNV-1 hash each octet of the buffer + */ + while (bp < be) { + if (m_a == false) { + /* multiply by the 64 bit FNV magic prime mod 2^64 */ + context->state *= PHP_FNV_64_PRIME; + + /* xor the bottom with the current octet */ + context->state ^= (uint64_t)*bp++; + } else { + /* xor the bottom with the current octet */ + context->state ^= (uint64_t)*bp++; + + /* multiply by the 64 bit FNV magic prime mod 2^64 */ + context->state *= PHP_FNV_64_PRIME; + } + } +} + +void hash_fnv132::hash_final(unsigned char *digest, void *context_) { + PHP_FNV132_CTX *context = (PHP_FNV132_CTX*)context_; +#ifdef WORDS_BIGENDIAN + memcpy(digest, &context->state, 4); +#else + int i = 0; + unsigned char *c = (unsigned char *) &context->state; + + for (i = 0; i < 4; i++) { + digest[i] = c[3 - i]; + } +#endif +} + +void hash_fnv164::hash_final(unsigned char *digest, void *context_) { + PHP_FNV164_CTX *context = (PHP_FNV164_CTX*)context_; +#ifdef WORDS_BIGENDIAN + memcpy(digest, &context->state, 8); +#else + int i = 0; + unsigned char *c = (unsigned char *) &context->state; + + for (i = 0; i < 8; i++) { + digest[i] = c[7 - i]; + } +#endif +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/hphp/runtime/ext/hash/hash_sha.h b/hphp/runtime/ext/hash/hash_fnv1.h similarity index 68% copy from hphp/runtime/ext/hash/hash_sha.h copy to hphp/runtime/ext/hash/hash_fnv1.h index 8cf7a7d77ac..37dfb858fee 100644 --- a/hphp/runtime/ext/hash/hash_sha.h +++ b/hphp/runtime/ext/hash/hash_fnv1.h @@ -15,55 +15,41 @@ +----------------------------------------------------------------------+ */ -#ifndef incl_HPHP_EXT_HASH_SHA_H_ -#define incl_HPHP_EXT_HASH_SHA_H_ +#ifndef incl_HPHP_EXT_HASH_FNV1_H_ +#define incl_HPHP_EXT_HASH_FNV1_H_ #include namespace HPHP { /////////////////////////////////////////////////////////////////////////////// -class hash_sha1 : public HashEngine { +class hash_fnv132 : public HashEngine { public: - hash_sha1(); + explicit hash_fnv132(bool a); virtual void hash_init(void *context); virtual void hash_update(void *context, const unsigned char *buf, unsigned int count); virtual void hash_final(unsigned char *digest, void *context); -}; - -class hash_sha256 : public HashEngine { -public: - hash_sha256(); - virtual void hash_init(void *context); - virtual void hash_update(void *context, const unsigned char *buf, - unsigned int count); - virtual void hash_final(unsigned char *digest, void *context); +private: + bool m_a; }; -class hash_sha384 : public HashEngine { +class hash_fnv164 : public HashEngine { public: - hash_sha384(); + explicit hash_fnv164(bool a); virtual void hash_init(void *context); virtual void hash_update(void *context, const unsigned char *buf, unsigned int count); virtual void hash_final(unsigned char *digest, void *context); -}; - -class hash_sha512 : public HashEngine { -public: - hash_sha512(); - virtual void hash_init(void *context); - virtual void hash_update(void *context, const unsigned char *buf, - unsigned int count); - virtual void hash_final(unsigned char *digest, void *context); +private: + bool m_a; }; /////////////////////////////////////////////////////////////////////////////// } -#endif // incl_HPHP_EXT_HASH_SHA_H_ +#endif // incl_HPHP_EXT_HASH_FNV1_H_ diff --git a/hphp/runtime/ext/hash/hash_sha.cpp b/hphp/runtime/ext/hash/hash_sha.cpp index 2bee432ff8d..9dfe95bb8e1 100644 --- a/hphp/runtime/ext/hash/hash_sha.cpp +++ b/hphp/runtime/ext/hash/hash_sha.cpp @@ -37,7 +37,8 @@ typedef struct { unsigned char buffer[64]; /* input buffer */ } PHP_SHA256_CTX; -hash_sha256::hash_sha256() : HashEngine(32, 64, sizeof(PHP_SHA256_CTX)) { +hash_sha256::hash_sha256(int size /*= 32 */) : + HashEngine(size, 64, sizeof(PHP_SHA256_CTX)) { } /////////////////////////////////////////////////////////////////////////////// @@ -347,22 +348,22 @@ void hash_sha1::hash_final(unsigned char *digest, void *context_) { /////////////////////////////////////////////////////////////////////////////// -#define ROTR32(b,x) ((x >> b) | (x << (32 - b))) -#define ROTR64(b,x) ((x >> b) | (x << (64 - b))) -#define SHR(b, x) (x >> b) +#define ROTR32(b,x) ((x >> b) | (x << (32 - b))) +#define ROTR64(b,x) ((x >> b) | (x << (64 - b))) +#define SHR(b, x) (x >> b) /* Ch */ -#define SHA256_F0(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) +#define SHA256_F0(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) /* Maj */ -#define SHA256_F1(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +#define SHA256_F1(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) /* SUM0 */ -#define SHA256_F2(x) (ROTR32( 2,(x)) ^ ROTR32(13,(x)) ^ ROTR32(22,(x))) +#define SHA256_F2(x) (ROTR32( 2,(x)) ^ ROTR32(13,(x)) ^ ROTR32(22,(x))) /* SUM1 */ -#define SHA256_F3(x) (ROTR32( 6,(x)) ^ ROTR32(11,(x)) ^ ROTR32(25,(x))) +#define SHA256_F3(x) (ROTR32( 6,(x)) ^ ROTR32(11,(x)) ^ ROTR32(25,(x))) /* OM0 */ -#define SHA256_F4(x) (ROTR32( 7,(x)) ^ ROTR32(18,(x)) ^ SHR( 3,(x))) +#define SHA256_F4(x) (ROTR32( 7,(x)) ^ ROTR32(18,(x)) ^ SHR( 3,(x))) /* OM1 */ -#define SHA256_F5(x) (ROTR32(17,(x)) ^ ROTR32(19,(x)) ^ SHR(10,(x))) +#define SHA256_F5(x) (ROTR32(17,(x)) ^ ROTR32(19,(x)) ^ SHR(10,(x))) static const unsigned int SHA256_K[64] = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, @@ -512,20 +513,43 @@ void hash_sha256::hash_final(unsigned char *digest, void *context_) { } /////////////////////////////////////////////////////////////////////////////// + +void hash_sha224::hash_init(void *context_) { + PHP_SHA256_CTX *context = (PHP_SHA256_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0xc1059ed8; + context->state[1] = 0x367cd507; + context->state[2] = 0x3070dd17; + context->state[3] = 0xf70e5939; + context->state[4] = 0xffc00b31; + context->state[5] = 0x68581511; + context->state[6] = 0x64f98fa7; + context->state[7] = 0xbefa4fa4; +} + +void hash_sha224::hash_final(unsigned char *digest, void *context_) { + unsigned char digest256[32]; + hash_sha256::hash_final(digest256, context_); + memcpy(digest, digest256, 28); +} + +/////////////////////////////////////////////////////////////////////////////// /* sha384/sha512 */ /* Ch */ -#define SHA512_F0(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) +#define SHA512_F0(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) /* Maj */ -#define SHA512_F1(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +#define SHA512_F1(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) /* SUM0 */ -#define SHA512_F2(x) (ROTR64(28, x) ^ ROTR64(34, x) ^ ROTR64(39, x)) +#define SHA512_F2(x) (ROTR64(28, x) ^ ROTR64(34, x) ^ ROTR64(39, x)) /* SUM1 */ -#define SHA512_F3(x) (ROTR64(14, x) ^ ROTR64(18, x) ^ ROTR64(41, x)) +#define SHA512_F3(x) (ROTR64(14, x) ^ ROTR64(18, x) ^ ROTR64(41, x)) /* OM0 */ -#define SHA512_F4(x) (ROTR64( 1, x) ^ ROTR64( 8, x) ^ SHR(7, x)) +#define SHA512_F4(x) (ROTR64( 1, x) ^ ROTR64( 8, x) ^ SHR(7, x)) /* OM1 */ -#define SHA512_F5(x) (ROTR64(19, x) ^ ROTR64(61, x) ^ SHR(6, x)) +#define SHA512_F5(x) (ROTR64(19, x) ^ ROTR64(61, x) ^ SHR(6, x)) static const uint64_t SHA512_K[128] = { L64(0x428a2f98d728ae22), L64(0x7137449123ef65cd), L64(0xb5c0fbcfec4d3b2f), L64(0xe9b5dba58189dbbc), diff --git a/hphp/runtime/ext/hash/hash_sha.h b/hphp/runtime/ext/hash/hash_sha.h index 8cf7a7d77ac..ba0e6c07e11 100644 --- a/hphp/runtime/ext/hash/hash_sha.h +++ b/hphp/runtime/ext/hash/hash_sha.h @@ -35,7 +35,7 @@ public: class hash_sha256 : public HashEngine { public: - hash_sha256(); + explicit hash_sha256(int size = 32); virtual void hash_init(void *context); virtual void hash_update(void *context, const unsigned char *buf, @@ -43,6 +43,17 @@ public: virtual void hash_final(unsigned char *digest, void *context); }; +/* sha224 is just sha256 with a different initial vector + * and a truncated output. + */ +class hash_sha224 : public hash_sha256 { +public: + hash_sha224() : hash_sha256(28) {} + + virtual void hash_init(void *context); + virtual void hash_final(unsigned char *digest, void *context); +}; + class hash_sha384 : public HashEngine { public: hash_sha384(); diff --git a/hphp/runtime/ext/hash/hash_tiger.cpp b/hphp/runtime/ext/hash/hash_tiger.cpp index eb0a427489a..b95571bb054 100644 --- a/hphp/runtime/ext/hash/hash_tiger.cpp +++ b/hphp/runtime/ext/hash/hash_tiger.cpp @@ -112,7 +112,7 @@ hash_tiger::hash_tiger(bool tiger3, int digest) x0=str[0]; x1=str[1]; x2=str[2]; x3=str[3]; \ x4=str[4]; x5=str[5]; x6=str[6]; x7=str[7]; #ifdef WORDS_BIGENDIAN -# define split(str) \ +# define split(str) \ { \ int i; \ uint64_t tmp[8]; \ @@ -123,7 +123,7 @@ hash_tiger::hash_tiger(bool tiger3, int digest) split_ex(tmp); \ } #else -# define split split_ex +# define split split_ex #endif #define tiger_compress(passes, str, state) \ @@ -230,32 +230,32 @@ void hash_tiger::hash_final(unsigned char *digest, void *context_) { switch (m_digest) { case 192: - digest[20] = (unsigned char) ((context->state[2] >> 24) & 0xff); - digest[21] = (unsigned char) ((context->state[2] >> 16) & 0xff); - digest[22] = (unsigned char) ((context->state[2] >> 8) & 0xff); - digest[23] = (unsigned char) (context->state[2] & 0xff); + digest[20] = (unsigned char) ((context->state[2] >> 32) & 0xff); + digest[21] = (unsigned char) ((context->state[2] >> 40) & 0xff); + digest[22] = (unsigned char) ((context->state[2] >> 48) & 0xff); + digest[23] = (unsigned char) ((context->state[2] >> 56) & 0xff); case 160: - digest[16] = (unsigned char) ((context->state[2] >> 56) & 0xff); - digest[17] = (unsigned char) ((context->state[2] >> 48) & 0xff); - digest[18] = (unsigned char) ((context->state[2] >> 40) & 0xff); - digest[19] = (unsigned char) ((context->state[2] >> 32) & 0xff); + digest[16] = (unsigned char) (context->state[2] & 0xff); + digest[17] = (unsigned char) ((context->state[2] >> 8) & 0xff); + digest[18] = (unsigned char) ((context->state[2] >> 16) & 0xff); + digest[19] = (unsigned char) ((context->state[2] >> 24) & 0xff); case 128: - digest[0] = (unsigned char) ((context->state[0] >> 56) & 0xff); - digest[1] = (unsigned char) ((context->state[0] >> 48) & 0xff); - digest[2] = (unsigned char) ((context->state[0] >> 40) & 0xff); - digest[3] = (unsigned char) ((context->state[0] >> 32) & 0xff); - digest[4] = (unsigned char) ((context->state[0] >> 24) & 0xff); - digest[5] = (unsigned char) ((context->state[0] >> 16) & 0xff); - digest[6] = (unsigned char) ((context->state[0] >> 8) & 0xff); - digest[7] = (unsigned char) (context->state[0] & 0xff); - digest[8] = (unsigned char) ((context->state[1] >> 56) & 0xff); - digest[9] = (unsigned char) ((context->state[1] >> 48) & 0xff); - digest[10] = (unsigned char) ((context->state[1] >> 40) & 0xff); - digest[11] = (unsigned char) ((context->state[1] >> 32) & 0xff); - digest[12] = (unsigned char) ((context->state[1] >> 24) & 0xff); - digest[13] = (unsigned char) ((context->state[1] >> 16) & 0xff); - digest[14] = (unsigned char) ((context->state[1] >> 8) & 0xff); - digest[15] = (unsigned char) (context->state[1] & 0xff); + digest[0] = (unsigned char) (context->state[0] & 0xff); + digest[1] = (unsigned char) ((context->state[0] >> 8) & 0xff); + digest[2] = (unsigned char) ((context->state[0] >> 16) & 0xff); + digest[3] = (unsigned char) ((context->state[0] >> 24) & 0xff); + digest[4] = (unsigned char) ((context->state[0] >> 32) & 0xff); + digest[5] = (unsigned char) ((context->state[0] >> 40) & 0xff); + digest[6] = (unsigned char) ((context->state[0] >> 48) & 0xff); + digest[7] = (unsigned char) ((context->state[0] >> 56) & 0xff); + digest[8] = (unsigned char) (context->state[1] & 0xff); + digest[9] = (unsigned char) ((context->state[1] >> 8) & 0xff); + digest[10] = (unsigned char) ((context->state[1] >> 16) & 0xff); + digest[11] = (unsigned char) ((context->state[1] >> 24) & 0xff); + digest[12] = (unsigned char) ((context->state[1] >> 32) & 0xff); + digest[13] = (unsigned char) ((context->state[1] >> 40) & 0xff); + digest[14] = (unsigned char) ((context->state[1] >> 48) & 0xff); + digest[15] = (unsigned char) ((context->state[1] >> 56) & 0xff); } memset(context, 0, sizeof(*context)); diff --git a/hphp/test/test_ext_hash.cpp b/hphp/test/test_ext_hash.cpp index 42256716bd8..1e794661da6 100644 --- a/hphp/test/test_ext_hash.cpp +++ b/hphp/test/test_ext_hash.cpp @@ -43,44 +43,44 @@ bool TestExtHash::RunTests(const std::string &which) { bool TestExtHash::test_hash() { static const char *expected[] = { - "1072638ba8fc6f2ff06c251b62f426fd", - "a1e0224d596927a56c8bae416b2ef23e", - "5c6ffbdd40d9556b73a21e63c3e0e904", - "c0854fb9fb03c41cce3802cb0d220529e6eef94e", - "68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483", - "b7273c05ad141ccb6696b3659e57137c453b6d64690fa7d5cf96368df4a7138703a8c6ead31727b487b3628746510391", - "0a8c150176c2ba391d7f1670ef4955cd99d3c3ec8cf06198cec30d436f2ac0c9b64229b5a54bdbd5563160503ce992a74be528761da9d0c48b7c74627302eb25", - "077a3fd0a18a01cb23c3e1bede846f99", - "ec457d0a974c48d5685a7efa03d137dc8bbde7e3", - "50c51844b845b31323765ae334349dd6a94db3e5b9624540bcbfa940f6857c3f", - "67b248ca0b750028e76f09f5f9b9b746f04c228ce659f75393c83ee46b82dea011f15f465a7e4f71", - "802dc377bf6dc4f905b90cf2f1ddb39d4958526c3772bce41c03488701630eeede851f5ddc195714ea9e35311a513e31c3b616ffce5756bd963e0fdc092b2f87", - "9370512795923aaeeb76fe3d8ea7433e", - "9370512795923aaeeb76fe3d8ea7433e0697d65d", - "9370512795923aaeeb76fe3d8ea7433e0697d65d1d6b3975", - "623163ed5f7b8e35ca1c2c1beb083289", - "623163ed5f7b8e35ca1c2c1beb0832891ab00cc6", - "623163ed5f7b8e35ca1c2c1beb0832891ab00cc615ef6e6b", - "1d4ca34cc860789a2a63fab87cd6a2c3ae5ecb1df8bd3cce605ffa2de1fbd73b", - "c10eb0cb71a04377a0452a4aa64853996f73cac95f6ae434df8083d473fac944", - "5e10f17b", - "413a86af", - "4246a382", - "aa517f0b69b75146a39384ec92a02877", - "d9f46869ef2bf66602a0725c079d35a9f3ac6dd0", - "04934beab28037aae8fd658389626368530562b96c9aba89", - "41c959f1e44e931b0473c54c49080d74d49a96ea56e766af408a85fd", - "6c7c17d5784428d4d62b7f652223d64a30c78aa5f2c2c71ce780ec3f0d0ec28d", - "31147399766a068d0417390a4b9fa0c8", - "ad9aa7904f202cdfb1faf7d385d10e3de575f74c", - "1568ff7e99ca98fbeb9a2d4c0318dcc290d0eb10d064d0f6", - "94656ade22076dd122714b4168a2ed8228b554f70eca5728c5038579", - "404e1584994409ee38e0829099521168ba7c3aa1b0e82d1a72ec387fd1317ecf", - "bc0db0f23eabcd9d0c4d0a2e498b8c47", - "51341aa150d38695628491580d8d6dc9850201f7", - "da27cf4bdb2decd4731c69a017534535eecd6d9b9015fc41", - "f8a5d442ef5b82e062599fe38ddbf46999b29f0a15caa8bebabbff68", - "16e1688c75cf09338fce299455ec0f6f783ca1cbb2006203ae6ae98b23f9294a" + "1072638ba8fc6f2ff06c251b62f426fd", // md2 + "a1e0224d596927a56c8bae416b2ef23e", // md4 + "5c6ffbdd40d9556b73a21e63c3e0e904", // md5 + "c0854fb9fb03c41cce3802cb0d220529e6eef94e", // sha1 + "68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483", // sha256 + "b7273c05ad141ccb6696b3659e57137c453b6d64690fa7d5cf96368df4a7138703a8c6ead31727b487b3628746510391", // sha384 + "0a8c150176c2ba391d7f1670ef4955cd99d3c3ec8cf06198cec30d436f2ac0c9b64229b5a54bdbd5563160503ce992a74be528761da9d0c48b7c74627302eb25", // sha512 + "077a3fd0a18a01cb23c3e1bede846f99", // ripemd128 + "ec457d0a974c48d5685a7efa03d137dc8bbde7e3", // ripemd160 + "50c51844b845b31323765ae334349dd6a94db3e5b9624540bcbfa940f6857c3f", // ripemd256 + "67b248ca0b750028e76f09f5f9b9b746f04c228ce659f75393c83ee46b82dea011f15f465a7e4f71", // ripemd320 + "802dc377bf6dc4f905b90cf2f1ddb39d4958526c3772bce41c03488701630eeede851f5ddc195714ea9e35311a513e31c3b616ffce5756bd963e0fdc092b2f87", // whirlpool + "ae3a9295275170933e43a78e3dfe76eb", // tiger128,3 + "ae3a9295275170933e43a78e3dfe76eb75396b1d", // tiger160,3 + "ae3a9295275170933e43a78e3dfe76eb75396b1d5dd69706", // tiger192,3 + "358e7b5fed633162893208eb1b2c1cca", // tiger128,4 + "358e7b5fed633162893208eb1b2c1cca6b6eef15", // tiger160,4 + "358e7b5fed633162893208eb1b2c1cca6b6eef15c60cb01a", // tiger192,4 + "1d4ca34cc860789a2a63fab87cd6a2c3ae5ecb1df8bd3cce605ffa2de1fbd73b", // snefru + "c10eb0cb71a04377a0452a4aa64853996f73cac95f6ae434df8083d473fac944", // ghost + "5e10f17b", // adler32 + "413a86af", // crc32 + "4246a382", // crc32a + "aa517f0b69b75146a39384ec92a02877", // haval128,3 + "d9f46869ef2bf66602a0725c079d35a9f3ac6dd0", // haval160,3 + "04934beab28037aae8fd658389626368530562b96c9aba89", // haval 192,3 + "41c959f1e44e931b0473c54c49080d74d49a96ea56e766af408a85fd", // haval224,3 + "6c7c17d5784428d4d62b7f652223d64a30c78aa5f2c2c71ce780ec3f0d0ec28d", // haval256,3 + "31147399766a068d0417390a4b9fa0c8", // haval128,4 + "ad9aa7904f202cdfb1faf7d385d10e3de575f74c", // haval160,4 + "1568ff7e99ca98fbeb9a2d4c0318dcc290d0eb10d064d0f6", // haval192,4 + "94656ade22076dd122714b4168a2ed8228b554f70eca5728c5038579", // haval224,4 + "404e1584994409ee38e0829099521168ba7c3aa1b0e82d1a72ec387fd1317ecf", // haval256,4 + "bc0db0f23eabcd9d0c4d0a2e498b8c47", // haval128,5 + "51341aa150d38695628491580d8d6dc9850201f7", // haval160,5 + "da27cf4bdb2decd4731c69a017534535eecd6d9b9015fc41", // haval192,5 + "f8a5d442ef5b82e062599fe38ddbf46999b29f0a15caa8bebabbff68", // haval224,5 + "16e1688c75cf09338fce299455ec0f6f783ca1cbb2006203ae6ae98b23f9294a" // haval256,5 }; String data = "The quick brown fox jumped over the lazy dog."; diff --git a/hphp/test/zend/bad/ext-hash/fnv132.php b/hphp/test/zend/good/ext-hash/fnv132.php similarity index 99% rename from hphp/test/zend/bad/ext-hash/fnv132.php rename to hphp/test/zend/good/ext-hash/fnv132.php index 2b5810d4b17..7bf814d8bff 100644 --- a/hphp/test/zend/bad/ext-hash/fnv132.php +++ b/hphp/test/zend/good/ext-hash/fnv132.php @@ -192,4 +192,4 @@ foreach($tests as $test) { if($pass) { echo "PASS"; } -?> \ No newline at end of file +?> diff --git a/hphp/test/zend/bad/ext-hash/fnv132.php.expectf b/hphp/test/zend/good/ext-hash/fnv132.php.expectf similarity index 100% rename from hphp/test/zend/bad/ext-hash/fnv132.php.expectf rename to hphp/test/zend/good/ext-hash/fnv132.php.expectf diff --git a/hphp/test/zend/bad/ext-hash/fnv164.php b/hphp/test/zend/good/ext-hash/fnv164.php similarity index 99% rename from hphp/test/zend/bad/ext-hash/fnv164.php rename to hphp/test/zend/good/ext-hash/fnv164.php index e02b5c47dd7..3a186b510f7 100644 --- a/hphp/test/zend/bad/ext-hash/fnv164.php +++ b/hphp/test/zend/good/ext-hash/fnv164.php @@ -192,4 +192,4 @@ foreach($tests as $test) { if($pass) { echo "PASS"; } -?> \ No newline at end of file +?> diff --git a/hphp/test/zend/bad/ext-hash/fnv164.php.expectf b/hphp/test/zend/good/ext-hash/fnv164.php.expectf similarity index 100% rename from hphp/test/zend/bad/ext-hash/fnv164.php.expectf rename to hphp/test/zend/good/ext-hash/fnv164.php.expectf diff --git a/hphp/test/zend/bad/ext-hash/sha224.php b/hphp/test/zend/good/ext-hash/sha224.php similarity index 85% rename from hphp/test/zend/bad/ext-hash/sha224.php rename to hphp/test/zend/good/ext-hash/sha224.php index f75f2a8a07f..92addff020f 100644 --- a/hphp/test/zend/bad/ext-hash/sha224.php +++ b/hphp/test/zend/good/ext-hash/sha224.php @@ -6,4 +6,4 @@ echo hash('sha224', '01234567890123456789012345678901234567890123456789012345678 /* FIPS-180 Vectors */ echo hash('sha224', 'abc') . "\n"; echo hash('sha224', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') . "\n"; -echo hash('sha224', str_repeat('a', 1000000)) . "\n"; \ No newline at end of file +echo hash('sha224', str_repeat('a', 1000000)) . "\n"; diff --git a/hphp/test/zend/bad/ext-hash/sha224.php.expectf b/hphp/test/zend/good/ext-hash/sha224.php.expectf similarity index 100% rename from hphp/test/zend/bad/ext-hash/sha224.php.expectf rename to hphp/test/zend/good/ext-hash/sha224.php.expectf diff --git a/hphp/test/zend/bad/ext-hash/tiger.php b/hphp/test/zend/good/ext-hash/tiger.php similarity index 98% rename from hphp/test/zend/bad/ext-hash/tiger.php rename to hphp/test/zend/good/ext-hash/tiger.php index d3569f481c8..cc9b5baff90 100644 --- a/hphp/test/zend/bad/ext-hash/tiger.php +++ b/hphp/test/zend/good/ext-hash/tiger.php @@ -4,4 +4,4 @@ echo hash('tiger192,3', 'abc'),"\n"; echo hash('tiger192,3', str_repeat('a', 63)),"\n"; echo hash('tiger192,3', str_repeat('abc', 61)),"\n"; echo hash('tiger192,3', str_repeat('abc', 64)),"\n"; -?> \ No newline at end of file +?> diff --git a/hphp/test/zend/bad/ext-hash/tiger.php.expectf b/hphp/test/zend/good/ext-hash/tiger.php.expectf similarity index 100% rename from hphp/test/zend/bad/ext-hash/tiger.php.expectf rename to hphp/test/zend/good/ext-hash/tiger.php.expectf -- 2.11.4.GIT