xref: /PHP-5.5/ext/mcrypt/tests/bug43143.phpt (revision 255913f5)
1--TEST--
2Bug #43143 (Warning about empty IV with MCRYPT_MODE_ECB)
3--SKIPIF--
4<?php if (!extension_loaded("mcrypt")) print "skip";
5if (!extension_loaded("hash")) print "skip"; ?>
6--FILE--
7<?php
8echo "ECB\n";
9$input = 'to be encrypted';
10$mkey = hash('sha256', 'secret key', TRUE);
11$data = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $mkey, $input, MCRYPT_MODE_ECB);
12echo "CFB\n";
13$input = 'to be encrypted';
14$mkey = hash('sha256', 'secret key', TRUE);
15$data = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $mkey, $input, MCRYPT_MODE_CFB);
16echo "END\n";
17?>
18--EXPECTF--
19ECB
20CFB
21
22Warning: mcrypt_encrypt(): Attempt to use an empty IV, which is NOT recommend in %sbug43143.php on line 9
23END
24