1--TEST-- 2Test normal operation of password_hash() with Argon2i and Argon2id 3--SKIPIF-- 4<?php 5if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2'); 6if (!defined('PASSWORD_ARGON2ID')) die('skip password_hash not built with Argon2'); 7?> 8--FILE-- 9<?php 10 11$password = "the password for testing 12345!"; 12 13$algos = [ 14 PASSWORD_ARGON2I, 15 'argon2i', 16 2, 17 PASSWORD_ARGON2ID, 18 'argon2id', 19 3, 20]; 21foreach ($algos as $algo) { 22 $hash = password_hash($password, $algo); 23 var_dump(password_verify($password, $hash)); 24 var_dump(password_get_info($hash)['algo']); 25} 26 27echo "OK!"; 28?> 29--EXPECT-- 30bool(true) 31string(7) "argon2i" 32bool(true) 33string(7) "argon2i" 34bool(true) 35string(7) "argon2i" 36bool(true) 37string(8) "argon2id" 38bool(true) 39string(8) "argon2id" 40bool(true) 41string(8) "argon2id" 42OK! 43