<?php
$hash = password_hash("foobar", PASSWORD_DEFAULT);
$new = str_replace('$2y$', '$2a$', $hash);
var_dump(password_verify('foobar', $hash));
var_dump(password_verify('foobar', $new));
var_dump(password_needs_rehash($new, PASSWORD_DEFAULT));
var_dump(password_needs_rehash($new, PASSWORD_DEFAULT, ['cost' => 12]));
- Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
- bool(true)
bool(true)
bool(true)
bool(true)
preferences:
142.96 ms | 403 KiB | 157 Q