xref: /PHP-8.1/ext/sodium/tests/bug78516.phpt (revision 6c9a0566)
1--TEST--
2Bug #78516 (password_hash(): Memory cost is not in allowed range)
3--EXTENSIONS--
4sodium
5--SKIPIF--
6<?php
7if (!defined('PASSWORD_ARGON2ID')) die('skip PASSWORD_ARGON2ID not available');
8?>
9--FILE--
10<?php
11$pass = password_hash('secret', PASSWORD_ARGON2ID, ['memory_cost' => 8191]);
12password_needs_rehash($pass, PASSWORD_ARGON2ID, ['memory_cost' => 8191]);
13var_dump(password_get_info($pass)['options']['memory_cost']);
14$pass = password_hash('secret', PASSWORD_ARGON2I, ['memory_cost' => 8191]);
15password_needs_rehash($pass, PASSWORD_ARGON2I, ['memory_cost' => 8191]);
16var_dump(password_get_info($pass)['options']['memory_cost']);
17?>
18--EXPECT--
19int(8191)
20int(8191)
21