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