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.
Esse commit está contido em:
@@ -27,7 +27,7 @@
|
||||
#include <runtime/ext/hash/hash_adler32.h>
|
||||
#include <runtime/ext/hash/hash_crc32.h>
|
||||
#include <runtime/ext/hash/hash_haval.h>
|
||||
|
||||
#include <runtime/ext/hash/hash_fnv1.h>
|
||||
#include <runtime/ext/hash/hash_furc.h>
|
||||
#include <runtime/ext/hash/hash_murmur.h>
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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 <runtime/ext/hash/hash_fnv1.h>
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#ifndef incl_HPHP_EXT_HASH_FNV1_H_
|
||||
#define incl_HPHP_EXT_HASH_FNV1_H_
|
||||
|
||||
#include <runtime/ext/hash/hash_engine.h>
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class hash_fnv132 : public HashEngine {
|
||||
public:
|
||||
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);
|
||||
|
||||
private:
|
||||
bool m_a;
|
||||
};
|
||||
|
||||
class hash_fnv164 : public HashEngine {
|
||||
public:
|
||||
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);
|
||||
|
||||
private:
|
||||
bool m_a;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
#endif // incl_HPHP_EXT_HASH_FNV1_H_
|
||||
@@ -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,
|
||||
@@ -511,21 +512,44 @@ void hash_sha256::hash_final(unsigned char *digest, void *context_) {
|
||||
memset((unsigned char*) context, 0, sizeof(*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),
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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.";
|
||||
|
||||
@@ -192,4 +192,4 @@ foreach($tests as $test) {
|
||||
if($pass) {
|
||||
echo "PASS";
|
||||
}
|
||||
?>
|
||||
?>
|
||||
@@ -192,4 +192,4 @@ foreach($tests as $test) {
|
||||
if($pass) {
|
||||
echo "PASS";
|
||||
}
|
||||
?>
|
||||
?>
|
||||
@@ -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";
|
||||
echo hash('sha224', str_repeat('a', 1000000)) . "\n";
|
||||
@@ -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";
|
||||
?>
|
||||
?>
|
||||
Referência em uma Nova Issue
Bloquear um usuário