1--TEST--
2openssl_pbkdf2() tests
3--SKIPIF--
4<?php if (!extension_loaded("openssl") || !function_exists("openssl_pbkdf2")) print "skip"; ?>
5--FILE--
6<?php
7// official test vectors
8var_dump(bin2hex(openssl_pbkdf2('password', 'salt', 20, 1)));
9var_dump(bin2hex(openssl_pbkdf2('password', 'salt', 20, 2)));
10var_dump(bin2hex(openssl_pbkdf2('password', 'salt', 20, 4096)));
11
12/* really slow but should be:
13string(40) "eefe3d61cd4da4e4e9945b3d6ba2158c2634e984"
14var_dump(bin2hex(openssl_pbkdf2('password', 'salt', 20, 16777216)));
15*/
16
17var_dump(bin2hex(openssl_pbkdf2('passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 25, 4096)));
18var_dump(bin2hex(openssl_pbkdf2("pass\0word", "sa\0lt", 16, 4096)));
19
20?>
21--EXPECTF--
22string(40) "0c60c80f961f0e71f3a9b524af6012062fe037a6"
23string(40) "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957"
24string(40) "4b007901b765489abead49d926f721d065a429c1"
25string(50) "3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038"
26string(32) "56fa6aa75548099dcc37d7f03425e0c3"
27