diff options
Diffstat (limited to 'ext/mhash')
-rw-r--r-- | ext/mhash/CREDITS | 2 | ||||
-rw-r--r-- | ext/mhash/config.m4 | 23 | ||||
-rw-r--r-- | ext/mhash/config.w32 | 16 | ||||
-rw-r--r-- | ext/mhash/mhash.c | 254 | ||||
-rw-r--r-- | ext/mhash/mhash.dsp | 115 | ||||
-rw-r--r-- | ext/mhash/php_mhash.h | 49 | ||||
-rw-r--r-- | ext/mhash/tests/001.phpt | 74 | ||||
-rw-r--r-- | ext/mhash/tests/002.phpt | 64 | ||||
-rw-r--r-- | ext/mhash/tests/003.phpt | 73 | ||||
-rw-r--r-- | ext/mhash/tests/skip.inc | 5 |
10 files changed, 0 insertions, 675 deletions
diff --git a/ext/mhash/CREDITS b/ext/mhash/CREDITS deleted file mode 100644 index 54851e1ac7..0000000000 --- a/ext/mhash/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -mhash -Sascha Schumann diff --git a/ext/mhash/config.m4 b/ext/mhash/config.m4 deleted file mode 100644 index 6b93decbcb..0000000000 --- a/ext/mhash/config.m4 +++ /dev/null @@ -1,23 +0,0 @@ -dnl -dnl $Id$ -dnl - -PHP_ARG_WITH(mhash, for mhash support, -[ --with-mhash[=DIR] Include mhash support.]) - -if test "$PHP_MHASH" != "no"; then - for i in $PHP_MHASH /usr/local /usr /opt/mhash; do - test -f $i/include/mhash.h && MHASH_DIR=$i && break - done - - if test -z "$MHASH_DIR"; then - AC_MSG_ERROR(Please reinstall libmhash - I cannot find mhash.h) - fi - - PHP_ADD_INCLUDE($MHASH_DIR/include) - PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/lib, MHASH_SHARED_LIBADD) - - PHP_NEW_EXTENSION(mhash, mhash.c, $ext_shared) - PHP_SUBST(MHASH_SHARED_LIBADD) - AC_DEFINE(HAVE_LIBMHASH,1,[ ]) -fi diff --git a/ext/mhash/config.w32 b/ext/mhash/config.w32 deleted file mode 100644 index f3da3bb0b6..0000000000 --- a/ext/mhash/config.w32 +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ -// vim:ft=javascript - -ARG_WITH("mhash", "mhash support", "no"); - -if (PHP_MHASH != "no") { - - if (CHECK_HEADER_ADD_INCLUDE('mhash.h', 'CFLAGS_MHASH') && - CHECK_LIB('libmhash.lib', 'mhash')) { - EXTENSION('mhash', 'mhash.c'); - AC_DEFINE('HAVE_LIBMHASH', 1); - } else { - WARNING("mhash not enabled; libraries and headers not found"); - } -} - diff --git a/ext/mhash/mhash.c b/ext/mhash/mhash.c deleted file mode 100644 index 58f1fb1740..0000000000 --- a/ext/mhash/mhash.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 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_0.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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sascha@schumann.cx> | - | Nikos Mavroyanopoulos <nmav@hellug.gr> (HMAC, KEYGEN) | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" - -#if HAVE_LIBMHASH - -#include "fcntl.h" -#include "php_mhash.h" -#include "mhash.h" -#include "php_ini.h" -#include "php_globals.h" -#include "ext/standard/info.h" - -function_entry mhash_functions[] = { - PHP_FE(mhash_get_block_size, NULL) - PHP_FE(mhash_get_hash_name, NULL) - PHP_FE(mhash_keygen_s2k, NULL) - PHP_FE(mhash_count, NULL) - PHP_FE(mhash, NULL) - {NULL, NULL, NULL} -}; - -zend_module_entry mhash_module_entry = { - STANDARD_MODULE_HEADER, - "mhash", - mhash_functions, - PHP_MINIT(mhash), NULL, - NULL, NULL, - PHP_MINFO(mhash), - NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES, -}; - -#ifdef COMPILE_DL_MHASH -ZEND_GET_MODULE(mhash) -#endif - -/* SALTED S2K uses a fixed salt */ -#define SALT_SIZE 8 - -PHP_MINIT_FUNCTION(mhash) -{ - int i, n, l; - char *name; - char buf[128]; - - n = mhash_count() + 1; - - for (i=0; i<n; i++) { - if ((name = mhash_get_hash_name(i))) { - l = snprintf(buf, 127, "MHASH_%s", name); - zend_register_long_constant(buf, l + 1, i, CONST_PERSISTENT, module_number TSRMLS_CC); - free(name); - } - } - - return SUCCESS; -} - -PHP_MINFO_FUNCTION(mhash) -{ - char version[32]; - - sprintf(version,"%d", MHASH_API_VERSION); - - php_info_print_table_start(); - php_info_print_table_row(2, "MHASH support", "Enabled"); - php_info_print_table_row(2, "MHASH API Version", version); - php_info_print_table_end(); -} - -/* {{{ proto int mhash_count(void) - Gets the number of available hashes */ -PHP_FUNCTION(mhash_count) -{ - if (ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; - } - - RETURN_LONG(mhash_count()); -} - -/* }}} */ - -/* {{{ proto int mhash_get_block_size(int hash) - Gets the block size of hash */ -PHP_FUNCTION(mhash_get_block_size) -{ - long hash; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash) == FAILURE) { - WRONG_PARAM_COUNT; - } - - RETURN_LONG(mhash_get_block_size(hash)); -} - -/* }}} */ - -/* {{{ proto string mhash_get_hash_name(int hash) - Gets the name of hash */ -PHP_FUNCTION(mhash_get_hash_name) -{ - char *name; - long hash; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash) == FAILURE) { - WRONG_PARAM_COUNT; - } - - name = mhash_get_hash_name(hash); - if (name) { - RETVAL_STRING(name, 1); - free(name); - } else { - RETVAL_FALSE; - } -} - -/* }}} */ - -/* {{{ proto string mhash(int hash, string data [, string key]) - Hash data with hash */ -PHP_FUNCTION(mhash) -{ - MHASH td; - int bsize; - unsigned char *hash_data; - long hash; - int data_len, key_len=0; - char *data, *key=NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls|s", &hash, &data, &data_len, &key, &key_len) == FAILURE) { - WRONG_PARAM_COUNT; - } - - bsize = mhash_get_block_size(hash); - - if (key_len) { - if (mhash_get_hash_pblock(hash) == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "mhash initialization failed"); - RETURN_FALSE; - } - td = mhash_hmac_init(hash, key, key_len, mhash_get_hash_pblock(hash)); - } else { - td = mhash_init(hash); - } - - if (td == MHASH_FAILED) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "mhash initialization failed"); - RETURN_FALSE; - } - - mhash(td, data, data_len); - - if (key_len) { - hash_data = (unsigned char *) mhash_hmac_end(td); - } else { - hash_data = (unsigned char *) mhash_end(td); - } - - if (hash_data) { - RETVAL_STRINGL(hash_data, bsize, 1); - mhash_free(hash_data); - } else { - RETURN_FALSE; - } -} - -/* }}} */ - -/* {{{ proto string mhash_keygen_s2k(int hash, string input_password, string salt, int bytes) - Generates a key using hash functions */ -PHP_FUNCTION(mhash_keygen_s2k) -{ - KEYGEN keystruct; - char salt[SALT_SIZE], *ret; - long hash, bytes; - char *password, *in_salt; - int password_len, salt_len; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lssl", &hash, &password, &password_len, &in_salt, &salt_len, &bytes) == FAILURE) { - WRONG_PARAM_COUNT; - } - if (bytes <= 0){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "the byte parameter must be greater then 0"); - RETURN_FALSE; - } - - salt_len = MIN(salt_len, SALT_SIZE); - - if (salt_len > mhash_get_keygen_salt_size(KEYGEN_S2K_SALTED)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, - "The specified salt [%d] is more bytes than the required by the algorithm [%d]\n", - salt_len, mhash_get_keygen_salt_size(KEYGEN_S2K_SALTED)); - } - - memcpy(salt, in_salt, salt_len); - if (salt_len < SALT_SIZE) { - memset(salt + salt_len, 0, SALT_SIZE - salt_len); - } - salt_len = SALT_SIZE; - - keystruct.hash_algorithm[0] = hash; - keystruct.hash_algorithm[1] = hash; - keystruct.count = 0; - keystruct.salt = salt; - keystruct.salt_size = salt_len; - - ret = emalloc(bytes + 1); - - if (mhash_keygen_ext(KEYGEN_S2K_SALTED, keystruct, ret, bytes, password, password_len) >= 0) { - ret[bytes] = '\0'; - RETVAL_STRINGL(ret, bytes, 0); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "mhash key generation failed"); - efree(ret); - RETURN_FALSE; - } -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/mhash/mhash.dsp b/ext/mhash/mhash.dsp deleted file mode 100644 index 0fa0226288..0000000000 --- a/ext/mhash/mhash.dsp +++ /dev/null @@ -1,115 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mhash" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=mhash - Win32 Release_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "mhash.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mhash.mak" CFG="mhash - Win32 Release_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mhash - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mhash - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "mhash - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_MHASH" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D "WIN32" /D "MHASH_EXPORTS" /D "COMPILE_DL_MHASH" /D HAVE_LIBMHASH=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts.lib libmhash.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_mhash.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "mhash - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Ignore_Export_Lib 0
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_MHASH" /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MHASH_EXPORTS" /D "COMPILE_DL_MHASH" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_MHASH=1 /D ZTS=1 /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x406 /d "NDEBUG"
-# ADD RSC /l 0x406 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /dll /machine:I386
-# ADD LINK32 php5ts_debug.lib libmhash.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_mhash.dll" /libpath:"..\..\Debug_TS"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "mhash - Win32 Release_TS"
-# Name "mhash - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mhash.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\php_mhash.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/ext/mhash/php_mhash.h b/ext/mhash/php_mhash.h deleted file mode 100644 index f9d6e18e54..0000000000 --- a/ext/mhash/php_mhash.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 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_0.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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sascha@schumann.cx> | - | Nikos Mavroyanopoulos <nmav@hellug.gr> (HMAC, KEYGEN) | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#ifndef PHP_MHASH_H -#define PHP_MHASH_H - -#if HAVE_LIBMHASH - -#if PHP_API_VERSION < 19990421 -#define zend_module_entry zend_module_entry -#include "zend_modules.h" -#include "internal_functions.h" -#endif - -extern zend_module_entry mhash_module_entry; -#define mhash_module_ptr &mhash_module_entry - -PHP_MINIT_FUNCTION(mhash); -PHP_MINFO_FUNCTION(mhash); -PHP_FUNCTION(mhash_get_block_size); -PHP_FUNCTION(mhash_get_hash_name); -PHP_FUNCTION(mhash_count); -PHP_FUNCTION(mhash_keygen_s2k); -PHP_FUNCTION(mhash); - -#else -#define mhash_module_ptr NULL -#endif - -#define phpext_mhash_ptr mhash_module_ptr - -#endif diff --git a/ext/mhash/tests/001.phpt b/ext/mhash/tests/001.phpt deleted file mode 100644 index 13c16a2263..0000000000 --- a/ext/mhash/tests/001.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -mhash() test ---INI-- -magic_quotes_runtime=0 ---SKIPIF-- -<?php - include "skip.inc"; -?> ---FILE-- -<?php - -$supported_hash_al = array( -"MHASH_MD5" => "-ۑNS*̓j", -"MHASH_SHA1" => "/AZI{;ہ*}", -"MHASH_HAVAL256" => "Ud'5ǐƕ; u", -"MHASH_HAVAL192" => "L7H0 *pɈ", -"MHASH_HAVAL224" => "SbхgR,r^&&K", -"MHASH_HAVAL160" => "ƳouWi\"q{", -"MHASH_RIPEMD160" => "lGCZYķƯF4\x0C>XX=", -"MHASH_GOST" => "\x0A%Rν|QGUC)5,-", -"MHASH_TIGER" => "y:g~ -0T\9", -"MHASH_CRC32" => "", -"MHASH_CRC32B" => "Z" -); - -$data = "This is the test of the mhash extension..."; - -foreach ($supported_hash_al as $hash=>$wanted) { - $result = mhash(constant($hash), $data); - if ($result==$wanted) { - echo "$hash\nok\n"; - } else { - echo "$hash: "; - var_dump($wanted); - echo "$hash: "; - var_dump($result); - } - echo "\n"; -} -?> ---EXPECT-- -MHASH_MD5 -ok - -MHASH_SHA1 -ok - -MHASH_HAVAL256 -ok - -MHASH_HAVAL192 -ok - -MHASH_HAVAL224 -ok - -MHASH_HAVAL160 -ok - -MHASH_RIPEMD160 -ok - -MHASH_GOST -ok - -MHASH_TIGER -ok - -MHASH_CRC32 -ok - -MHASH_CRC32B -ok diff --git a/ext/mhash/tests/002.phpt b/ext/mhash/tests/002.phpt deleted file mode 100644 index 6f89bc2272..0000000000 --- a/ext/mhash/tests/002.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -mhash_get_block_size() & mhash_get_hash_name() test ---SKIPIF-- -<?php - include "skip.inc"; -?> ---FILE-- -<?php -$supported_hash_al = array( -"MD5" => 16, -"MD4" => 16, -"SHA1" => 20, -"SHA256" => 32, -"HAVAL256" => 32, -"HAVAL192" => 24, -"HAVAL224" => 28, -"HAVAL160" => 20, -"HAVAL128" => 16, -"RIPEMD160" => 20, -"GOST" => 32, -"TIGER" => 24, -"TIGER160" => 20, -"TIGER128" => 16, -"CRC32" => 4, -"CRC32B" => 4, -"ADLER32" => 4, -"NA_XYZ" => 0 /* verify that the algorythm works */ -); - -$hc = mhash_count() + 1; - -$known_hash_al = array(); -for ($i=0; $i < $hc; $i++) { - $known_hash_al[mhash_get_hash_name($i)] = $i; -} - -foreach ($supported_hash_al as $name => $len) { - if (array_key_exists($name, $known_hash_al)) { - $len = mhash_get_block_size($known_hash_al[$name]); - echo "$name = $len\n"; - } else { - echo "$name ? $len\n"; - } -} -?> ---EXPECTREGEX-- -MD5 . 16 -MD4 . 16 -SHA1 . 20 -SHA256 . 32 -HAVAL256 . 32 -HAVAL192 . 24 -HAVAL224 . 28 -HAVAL160 . 20 -HAVAL128 . 16 -RIPEMD160 . 20 -GOST . 32 -TIGER . 24 -TIGER160 . 20 -TIGER128 . 16 -CRC32 . 4 -CRC32B . 4 -ADLER32 . 4 -NA_XYZ . 0 diff --git a/ext/mhash/tests/003.phpt b/ext/mhash/tests/003.phpt deleted file mode 100644 index e5995f2a02..0000000000 --- a/ext/mhash/tests/003.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -mhash_keygen_s2k() test ---SKIPIF-- -<?php - include "skip.inc"; -?> ---FILE-- -<?php - -$supported_hash_al = array( -"MHASH_MD5" => "\x15N24zPF\x06栔\x0CTyzcght^W\x09-sA7Y:\x10wݲxdqS^҃&U,: aǙz\x06\x1CS\x01", -"MHASH_SHA1" => "1\\p\x06\x1D\x07E]S\x0B\x08\x0Caf\\\x1A\x01\x10T#\$2\x06xc\x0A=\x16\"IJ\x0E'NΚԽn\x08J3\x15<+H\x13\x1D0[\x00[Y\x12qء\x19KmI", -"MHASH_HAVAL256" => "G\x00NPw\x0CH6Wل+,\x1C\x0DgdZU\x07)oAi[NadT\x17\x1F2ZU46}IYb,C\x17\x1Au{[x", -"MHASH_HAVAL224" => "\\J=Z\x08\x08y8ha\x0Apg|yܫq\x19\x1E\x06) -˼lnjG\x0CB@kwºQv52OP-05\x00L m`G-2I", -"MHASH_HAVAL192" => "\"q&\x02<.A\x07/\x1E2d\x17\x1C2Xv\x0Bpű%\x03\x16(C;+\x08pz8\x12\x15\x13N\x08udd)qهv_MINxLtLJ", -"MHASH_HAVAL160" => "\x07dn6GXm\x06\x1E\x00η#5M\"mi\x1D1\$\x0E|X<O)Y;=ʰy.`\"`\x02ٴB ԯҵk>G\x19\x17~\x0D~", -"MHASH_RIPEMD160" => "Fx\x0D5\x02\x0a\x1D[\x19gDXgwܡD&bjB7]G[\x14G`^\x1B\x08K\x11\x173C-AB%\x04K\x03??K", -"MHASH_GOST" => "Di~C=wƂ\x17B\x15}sM\x01d|\x014hY\"\x0AI*b@фxc@sިyN%d\x09FD\x0a\x12\x12P\x0F}E~:pO\x0DpwR{\x19M", -"MHASH_TIGER" => "g{\nG&/3d#7`2UBQ/y)X#k'hn/Ep*M1 VKyO` M6|\"", -"MHASH_CRC32" => "H@&_YoQ1[Fq\"\x08fV8\x08EE<M:Ⱥrk*Hu/}h3iWJ?vu -i=W\"", -"MHASH_CRC32B" => "le>}*]Fכ6\x13bCˏ. I\x0FjΥ0\x0D\x1F<.Qy疾tixb\$}\x0Bȴ ϬȌDDK\x131uL6`ɏ|Ec\x04", -); - -foreach ($supported_hash_al as $hash=>$wanted) { - $passwd = str_repeat($hash, 10); - $salt = str_repeat($hash, 2); - $result = mhash_keygen_s2k(constant($hash), $passwd, $salt, 100); - if (!strcmp($result, $wanted)) { - echo "$hash\nok\n"; - } else { - echo "$hash: "; - var_dump(bin2hex($wanted)); - echo "$hash: "; - var_dump(bin2hex($result)); - } - echo "\n"; -} -?> ---EXPECT-- -MHASH_MD5 -ok - -MHASH_SHA1 -ok - -MHASH_HAVAL256 -ok - -MHASH_HAVAL224 -ok - -MHASH_HAVAL192 -ok - -MHASH_HAVAL160 -ok - -MHASH_RIPEMD160 -ok - -MHASH_GOST -ok - -MHASH_TIGER -ok - -MHASH_CRC32 -ok - -MHASH_CRC32B -ok diff --git a/ext/mhash/tests/skip.inc b/ext/mhash/tests/skip.inc deleted file mode 100644 index 81912d21c8..0000000000 --- a/ext/mhash/tests/skip.inc +++ /dev/null @@ -1,5 +0,0 @@ -<?php -if (!extension_loaded("mhash")) { - die("skip mhash extension is not avaliable"); -} -?>
\ No newline at end of file |