mirror of
https://github.com/php/php-src.git
synced 2024-12-04 15:23:44 +08:00
Fix a bunch of binary/unicode issues in the mcrypt tests
This commit is contained in:
parent
4743436576
commit
4551e0fda3
@ -5,7 +5,7 @@ Bug #41252 (Calling mcrypt_generic without first calling mcrypt_generic_init cra
|
||||
--FILE--
|
||||
<?php
|
||||
$td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
|
||||
echo mcrypt_generic($td,'aaaaaaaa');
|
||||
echo mcrypt_generic($td,b'aaaaaaaa');
|
||||
print "I'm alive!\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
@ -4,8 +4,8 @@ mcrypt_cbc
|
||||
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "FooBar";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$key = b"FooBar";
|
||||
$secret = b"PHP Testfest 2008";
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
|
||||
|
@ -4,8 +4,8 @@ mcrypt_cbf
|
||||
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "FooBar";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$key = b"FooBar";
|
||||
$secret = b"PHP Testfest 2008";
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
|
||||
|
@ -4,8 +4,8 @@ mcrypt_decrypt
|
||||
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "FooBar";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$key = b"FooBar";
|
||||
$secret = b"PHP Testfest 2008";
|
||||
$mode = MCRYPT_MODE_CBC;
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
@ -18,7 +18,7 @@ echo trim(mcrypt_decrypt($cipher, $key, $enc_data, $mode, $iv)) . "\n";
|
||||
// a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
|
||||
mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CBC);
|
||||
|
||||
var_dump(strpos(mcrypt_decrypt(MCRYPT_BLOWFISH, "FooBar", $enc_data, MCRYPT_MODE_CBC, $iv), "Testfest") !== false);
|
||||
var_dump(strpos(mcrypt_decrypt(MCRYPT_BLOWFISH, b"FooBar", $enc_data, MCRYPT_MODE_CBC, $iv), b"Testfest") !== false);
|
||||
--EXPECTF--
|
||||
PHP Testfest 2008
|
||||
|
||||
|
@ -4,8 +4,8 @@ mcrypt_ecb
|
||||
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "FooBar";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$key = b"FooBar";
|
||||
$secret = b"PHP Testfest 2008";
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
|
||||
|
@ -8,19 +8,19 @@ var_dump(mcrypt_list_modes());
|
||||
--EXPECT--
|
||||
array(8) {
|
||||
[0]=>
|
||||
string(3) "cbc"
|
||||
unicode(3) "cbc"
|
||||
[1]=>
|
||||
string(3) "cfb"
|
||||
unicode(3) "cfb"
|
||||
[2]=>
|
||||
string(3) "ctr"
|
||||
unicode(3) "ctr"
|
||||
[3]=>
|
||||
string(3) "ecb"
|
||||
unicode(3) "ecb"
|
||||
[4]=>
|
||||
string(4) "ncfb"
|
||||
unicode(4) "ncfb"
|
||||
[5]=>
|
||||
string(4) "nofb"
|
||||
unicode(4) "nofb"
|
||||
[6]=>
|
||||
string(3) "ofb"
|
||||
unicode(3) "ofb"
|
||||
[7]=>
|
||||
string(6) "stream"
|
||||
unicode(6) "stream"
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ mcrypt_ofb
|
||||
<?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$key = "FooBar";
|
||||
$secret = "PHP Testfest 2008";
|
||||
$key = b"FooBar";
|
||||
$secret = b"PHP Testfest 2008";
|
||||
$cipher = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
|
||||
|
Loading…
Reference in New Issue
Block a user