diff options
Diffstat (limited to 'ext/mcrypt/tests')
26 files changed, 226 insertions, 226 deletions
diff --git a/ext/mcrypt/tests/blowfish.phpt b/ext/mcrypt/tests/blowfish.phpt index 8b06d6ec7a..e110a79b50 100644 --- a/ext/mcrypt/tests/blowfish.phpt +++ b/ext/mcrypt/tests/blowfish.phpt @@ -8,7 +8,7 @@ if(!function_exists("hex2bin")) { function hex2bin($data) { $len = strlen($data); return pack("H" . $len, $data); - } + } } print "key plain crypt guess stat\n"; @@ -24,7 +24,7 @@ foreach($vectors as $data) { printf("%s %s ", $key, $plain - ); + ); $key = hex2bin(trim($key)); $plain = hex2bin(($plain)); $crypt = strtolower(trim($crypt)); @@ -36,8 +36,8 @@ foreach($vectors as $data) { $crypt, $guess, ($crypt==$guess ? "OK" : "BAD") - ); - } + ); + } } // Longer test case from http://www.schneier.com/code/vectors.txt diff --git a/ext/mcrypt/tests/bug37595.phpt b/ext/mcrypt/tests/bug37595.phpt Binary files differindex a125629c03..23c024029e 100644 --- a/ext/mcrypt/tests/bug37595.phpt +++ b/ext/mcrypt/tests/bug37595.phpt diff --git a/ext/mcrypt/tests/bug43143.phpt b/ext/mcrypt/tests/bug43143.phpt index 904bfb7003..432fc89a0f 100644 --- a/ext/mcrypt/tests/bug43143.phpt +++ b/ext/mcrypt/tests/bug43143.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #43143 (Warning about empty IV with MCRYPT_MODE_ECB) --SKIPIF-- -<?php if (!extension_loaded("mcrypt")) print "skip"; +<?php if (!extension_loaded("mcrypt")) print "skip"; if (!extension_loaded("hash")) print "skip"; ?> --FILE-- <?php diff --git a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt index b306a8a94e..73467c2118 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_3des_decrypt.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_cbc() function : basic functionality +Test mcrypt_cbc() function : basic functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv) - * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv + * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ $cipher = MCRYPT_TRIPLEDES; @@ -19,9 +19,9 @@ $data = b"This is the secret message which must be encrypted"; // tripledes uses keys with exactly 192 bits (24 bytes) $keys = array( - b'12345678', - b'12345678901234567890', - b'123456789012345678901234', + b'12345678', + b'12345678901234567890', + b'123456789012345678901234', b'12345678901234567890123456' ); $data1 = array( @@ -32,8 +32,8 @@ $data1 = array( ); // tripledes is a block cipher of 64 bits (8 bytes) $ivs = array( - b'1234', - b'12345678', + b'1234', + b'12345678', b'123456789' ); // data represented in base64 (ascii) @@ -50,7 +50,7 @@ for ($i = 0; $i < sizeof($keys); $i++) { special_var_dump(mcrypt_decrypt($cipher, $keys[$i], base64_decode($data1[$i]), MCRYPT_MODE_CBC, $iv)); } -$key = b'123456789012345678901234'; +$key = b'123456789012345678901234'; echo "\n--- testing different iv lengths\n"; for ($i = 0; $i < sizeof($ivs); $i++) { echo "\niv length=".strlen($ivs[$i])."\n"; @@ -59,7 +59,7 @@ for ($i = 0; $i < sizeof($ivs); $i++) { function special_var_dump($str) { var_dump(bin2hex($str)); -} +} ?> ===DONE=== --EXPECTF-- diff --git a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt index 0fea9063df..2fceed2060 100644 --- a/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_cbc_3des_encrypt.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_cbc() function : basic functionality +Test mcrypt_cbc() function : basic functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv) - * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv + * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ $cipher = MCRYPT_TRIPLEDES; @@ -19,14 +19,14 @@ $data = b"This is the secret message which must be encrypted"; // tripledes uses keys with exactly 192 bits (24 bytes) $keys = array( - b'12345678', - b'12345678901234567890', - b'123456789012345678901234', + b'12345678', + b'12345678901234567890', + b'123456789012345678901234', b'12345678901234567890123456'); // tripledes is a block cipher of 64 bits (8 bytes) $ivs = array( - b'1234', - b'12345678', + b'1234', + b'12345678', b'123456789'); @@ -37,7 +37,7 @@ foreach ($keys as $key) { var_dump(bin2hex(mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_CBC, $iv))); } -$key = b'123456789012345678901234'; +$key = b'123456789012345678901234'; echo "\n--- testing different iv lengths\n"; foreach ($ivs as $iv) { echo "\niv length=".strlen($iv)."\n"; diff --git a/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt b/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt index cc5996d410..052e708ad3 100644 --- a/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt +++ b/ext/mcrypt/tests/mcrypt_decrypt_3des_cbc.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_decrypt() function : basic functionality +Test mcrypt_decrypt() function : basic functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_decrypt() : basic functionality ***\n"; @@ -23,9 +23,9 @@ $mode = MCRYPT_MODE_CBC; // tripledes uses keys with exactly 192 bits (24 bytes) $keys = array( - b'12345678', - b'12345678901234567890', - b'123456789012345678901234', + b'12345678', + b'12345678901234567890', + b'123456789012345678901234', b'12345678901234567890123456' ); $data1 = array( @@ -36,8 +36,8 @@ $data1 = array( ); // tripledes is a block cipher of 64 bits (8 bytes) $ivs = array( - b'1234', - b'12345678', + b'1234', + b'12345678', b'123456789' ); $data2 = array( @@ -62,7 +62,7 @@ for ($i = 0; $i < sizeof($ivs); $i++) { function special_var_dump($str) { var_dump(bin2hex($str)); -} +} ?> ===DONE=== --EXPECTF-- diff --git a/ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt b/ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt index e86a5650fe..b83c168922 100644 --- a/ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt +++ b/ext/mcrypt/tests/mcrypt_decrypt_3des_ecb.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_decrypt() function : basic functionality +Test mcrypt_decrypt() function : basic functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_decrypt() : basic functionality ***\n"; @@ -23,9 +23,9 @@ $mode = MCRYPT_MODE_ECB; // tripledes uses keys with exactly 192 bits (24 bytes) $keys = array( - b'12345678', - b'12345678901234567890', - b'123456789012345678901234', + b'12345678', + b'12345678901234567890', + b'123456789012345678901234', b'12345678901234567890123456' ); $data1 = array( @@ -36,8 +36,8 @@ $data1 = array( ); // tripledes is a block cipher of 64 bits (8 bytes) $ivs = array( - b'1234', - b'12345678', + b'1234', + b'12345678', b'123456789' ); $data2 = array( @@ -52,7 +52,7 @@ for ($i = 0; $i < sizeof($keys); $i++) { special_var_dump(mcrypt_decrypt($cipher, $keys[$i], base64_decode($data1[$i]), $mode)); } -$key = b'123456789012345678901234'; +$key = b'123456789012345678901234'; echo "\n--- testing different iv lengths\n"; for ($i = 0; $i < sizeof($ivs); $i++) { echo "\niv length=".strlen($ivs[$i])."\n"; @@ -61,7 +61,7 @@ for ($i = 0; $i < sizeof($ivs); $i++) { function special_var_dump($str) { var_dump(bin2hex($str)); -} +} ?> ===DONE=== --EXPECTF-- diff --git a/ext/mcrypt/tests/mcrypt_decrypt_error.phpt b/ext/mcrypt/tests/mcrypt_decrypt_error.phpt index b99b51c96a..a4d7bf4f42 100644 --- a/ext/mcrypt/tests/mcrypt_decrypt_error.phpt +++ b/ext/mcrypt/tests/mcrypt_decrypt_error.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_decrypt() function : error conditions +Test mcrypt_decrypt() function : error conditions --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_decrypt() : error conditions ***\n"; diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation1.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation1.phpt index 37fffad4d7..d04d67c713 100644 --- a/ext/mcrypt/tests/mcrypt_decrypt_variation1.phpt +++ b/ext/mcrypt/tests/mcrypt_decrypt_variation1.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_decrypt() function : usage variation +Test mcrypt_decrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_decrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for cipher diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt index 25cc371f75..29885beb6d 100644 --- a/ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt +++ b/ext/mcrypt/tests/mcrypt_decrypt_variation2.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_decrypt() function : usage variation +Test mcrypt_decrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_decrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for key diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt index caa3635986..a0c38dfe3b 100644 --- a/ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt +++ b/ext/mcrypt/tests/mcrypt_decrypt_variation3.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_decrypt() function : usage variation +Test mcrypt_decrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_decrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for data diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt index 575ed8e9d7..456acca3b3 100644 --- a/ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt +++ b/ext/mcrypt/tests/mcrypt_decrypt_variation4.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_decrypt() function : usage variation +Test mcrypt_decrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_decrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for mode diff --git a/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt b/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt index 9fd28498d1..29946f8515 100644 --- a/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt +++ b/ext/mcrypt/tests/mcrypt_decrypt_variation5.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_decrypt() function : usage variation +Test mcrypt_decrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_decrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for iv diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt index 635ca25a55..6021c4f683 100644 --- a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt @@ -1,19 +1,19 @@ --TEST-- -Test mcrypt_cbc() function : basic functionality +Test mcrypt_cbc() function : basic functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php error_reporting(E_ALL); /* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv) - * Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ $cipher = MCRYPT_TRIPLEDES; @@ -21,9 +21,9 @@ $data = b"This is the secret message which must be encrypted"; // tripledes uses keys up to 192 bits (24 bytes) $keys = array( - b'12345678', - b'12345678901234567890', - b'123456789012345678901234', + b'12345678', + b'12345678901234567890', + b'123456789012345678901234', b'12345678901234567890123456' ); $data1 = array( @@ -34,8 +34,8 @@ $data1 = array( ); // tripledes is a block cipher of 64 bits (8 bytes) $ivs = array( - b'1234', - b'12345678', + b'1234', + b'12345678', b'123456789' ); $data2 = array( @@ -60,7 +60,7 @@ for ($i = 0; $i < sizeof($ivs); $i++) { function special_var_dump($str) { var_dump(bin2hex($str)); -} +} ?> ===DONE=== --EXPECTF-- diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt index 68f056c510..2c90652b81 100644 --- a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt @@ -1,19 +1,19 @@ --TEST-- -Test mcrypt_ecb() function : basic functionality +Test mcrypt_ecb() function : basic functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php error_reporting(E_ALL); /* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv) - * Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ $cipher = MCRYPT_TRIPLEDES; @@ -21,15 +21,15 @@ $data = b"This is the secret message which must be encrypted"; // tripledes uses keys up to 192 bits (24 bytes) $keys = array( - b'12345678', - b'12345678901234567890', - b'123456789012345678901234', + b'12345678', + b'12345678901234567890', + b'123456789012345678901234', b'12345678901234567890123456' ); // tripledes is a block cipher of 64 bits (8 bytes) $ivs = array( - b'1234', - b'12345678', + b'1234', + b'12345678', b'123456789' ); diff --git a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt index 15b3c886fa..0cc92890bd 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_encrypt() function : TripleDES functionality +Test mcrypt_encrypt() function : TripleDES functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_encrypt() : TripleDES functionality ***\n"; @@ -20,7 +20,7 @@ echo "*** Testing mcrypt_encrypt() : TripleDES functionality ***\n"; //test encrypt decrypt //test tripledes, aes //test different lengths of key, iv -//test no iv being passed on CBC, ECB +//test no iv being passed on CBC, ECB //test up to 32 bytes with unlimited strength $cipher = MCRYPT_TRIPLEDES; @@ -29,15 +29,15 @@ $data = b'This is the secret message which must be encrypted'; // tripledes uses keys up to 192 bits (24 bytes) $keys = array( - b'12345678', - b'12345678901234567890', - b'123456789012345678901234', + b'12345678', + b'12345678901234567890', + b'123456789012345678901234', b'12345678901234567890123456' ); // tripledes is a block cipher of 64 bits (8 bytes) $ivs = array( - b'1234', - b'12345678', + b'1234', + b'12345678', b'123456789' ); diff --git a/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt index ffcabf8f5f..d785613074 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt @@ -1,17 +1,17 @@ --TEST-- Test mcrypt_encrypt() function : TripleDES functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_encrypt() : TripleDES functionality ***\n"; @@ -22,9 +22,9 @@ $data = b'This is the secret message which must be encrypted'; // tripledes uses keys up to 192 bits (24 bytes) $keys = array( - b'12345678', - b'12345678901234567890', - b'123456789012345678901234', + b'12345678', + b'12345678901234567890', + b'123456789012345678901234', b'12345678901234567890123456' ); @@ -36,8 +36,8 @@ foreach ($keys as $key) { $key = b'123456789012345678901234'; $ivs = array( - b'1234', - b'12345678', + b'1234', + b'12345678', b'123456789' ); diff --git a/ext/mcrypt/tests/mcrypt_encrypt_error.phpt b/ext/mcrypt/tests/mcrypt_encrypt_error.phpt index 98775d317b..bbae095d9f 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_error.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_error.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_encrypt() function : error conditions +Test mcrypt_encrypt() function : error conditions --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_encrypt() : error conditions ***\n"; diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation1.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation1.phpt index 88b6edef3d..19aab794b1 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_variation1.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_variation1.phpt @@ -1,17 +1,17 @@ --TEST-- Test mcrypt_encrypt() function : usage variation - different types for cipher --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_encrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for cipher diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt index fa0cd81665..c64f944b44 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_variation2.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_encrypt() function : usage variation +Test mcrypt_encrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_encrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for key diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt index 17698d20d9..5bd265d38d 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_variation3.phpt @@ -1,17 +1,17 @@ --TEST-- Test mcrypt_encrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} -?> + print "skip - mcrypt extension not loaded"; +} +?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_encrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for data diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt index 363defdcf0..da5c9de866 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_variation4.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_encrypt() function : usage variation +Test mcrypt_encrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_encrypt() : usage variation ***\n"; @@ -104,9 +104,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for mode diff --git a/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt b/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt index 7ad6dd5f9a..0879a0003b 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_variation5.phpt @@ -1,17 +1,17 @@ --TEST-- -Test mcrypt_encrypt() function : usage variation +Test mcrypt_encrypt() function : usage variation --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt_encrypt() : usage variation ***\n"; @@ -105,9 +105,9 @@ $inputs = array( // unset data 'unset var' => @$unset_var, - + // resource variable - 'resource' => $fp + 'resource' => $fp ); // loop through each element of the array for iv diff --git a/ext/mcrypt/tests/mcrypt_filters.phpt b/ext/mcrypt/tests/mcrypt_filters.phpt index c8146ea984..3cae60bb59 100644 --- a/ext/mcrypt/tests/mcrypt_filters.phpt +++ b/ext/mcrypt/tests/mcrypt_filters.phpt @@ -14,7 +14,7 @@ $secretfile = 'secert-file.tmp'; $passphrase = 'My secret'; $iv = substr(md5('iv'.$passphrase, true), 0, 8); -$key = substr(md5('pass1'.$passphrase, true) . +$key = substr(md5('pass1'.$passphrase, true) . md5('pass2'.$passphrase, true), 0, 24); $opts = array('iv'=>$iv, 'key'=>$key); diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt index d9e7d96bbc..2af5e33d8b 100644 --- a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt +++ b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt @@ -1,27 +1,27 @@ --TEST-- -Test mcrypt_encrypt() function : AES functionality +Test mcrypt_encrypt() function : AES functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ /* Prototype : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv) - * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv + * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt : Rijndael128 functionality ***\n"; @@ -32,17 +32,17 @@ $data = b'This is the secret message which must be encrypted'; // keys up to 128 bits (16 bytes) $keys = array( - null, - '', - b'12345678', + null, + '', + b'12345678', b'1234567890123456' ); // rijndael128 is a block cipher of 128 bits (16 bytes) $ivs = array( - null, - '', - b'12345678', - b'1234567890123456', + null, + '', + b'12345678', + b'1234567890123456', b'12345678901234567' ); @@ -55,12 +55,12 @@ foreach ($keys as $key) { var_dump(bin2hex($res)); } -$key = b'1234567890123456'; +$key = b'1234567890123456'; echo "\n--- testing different iv lengths\n"; foreach ($ivs as $iv) { echo "\niv length=".strlen($iv)."\n"; $res = mcrypt_decrypt($cipher, $key, $res, MCRYPT_MODE_CBC, $iv); - var_dump(bin2hex($res)); + var_dump(bin2hex($res)); } ?> diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt index 7fef8af36d..66ec8460cd 100644 --- a/ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt +++ b/ext/mcrypt/tests/mcrypt_rijndael128_256BitKey.phpt @@ -1,32 +1,32 @@ --TEST-- -Test mcrypt_encrypt() function : AES functionality +Test mcrypt_encrypt() function : AES functionality --SKIPIF-- -<?php +<?php if (!extension_loaded("mcrypt")) { - print "skip - mcrypt extension not loaded"; -} + print "skip - mcrypt extension not loaded"; +} ?> --FILE-- <?php /* Prototype : string mcrypt_encrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ /* Prototype : string mcrypt_decrypt(string cipher, string key, string data, string mode, string iv) - * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: OFB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ /* Prototype : string mcrypt_cbc(int cipher, string key, string data, int mode, string iv) - * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv + * Description: CBC crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ /* Prototype : string mcrypt_ecb(int cipher, string key, string data, int mode, string iv) - * Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv + * Description: ECB crypt/decrypt data using key key with cipher cipher starting with iv * Source code: ext/mcrypt/mcrypt.c - * Alias to functions: + * Alias to functions: */ echo "*** Testing mcrypt : Rijndael128 functionality ***\n"; @@ -37,8 +37,8 @@ $data = b'This is the secret message which must be encrypted'; // keys : 20 bytes, 24 bytes, 30 Bytes, 32 Bytes, 40 Bytes $keys = array( - b'12345678901234567890', - b'123456789012345678901234', + b'12345678901234567890', + b'123456789012345678901234', b'123456789012345678901234567890', b'12345678901234567890123456789012', b'1234567890123456789012345678901234567890' @@ -52,7 +52,7 @@ foreach ($keys as $key) { $res = mcrypt_encrypt($cipher, $key, $data, MCRYPT_MODE_CBC, $iv); var_dump(bin2hex($res)); $res = mcrypt_decrypt($cipher, $key, $res, MCRYPT_MODE_CBC, $iv); - var_dump(bin2hex($res)); + var_dump(bin2hex($res)); } ?> ===DONE=== |