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