xref: /PHP-7.1/ext/mcrypt/tests/bug43143.phpt (revision 7af945e2)
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
20
21Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug43143.php on line 5
22CFB
23
24Deprecated: Function mcrypt_encrypt() is deprecated in %s%ebug43143.php on line 9
25
26Warning: mcrypt_encrypt(): Encryption mode requires an initialization vector of size 32 in %sbug43143.php on line 9
27END
28