CKTIS / PHP
password_verify()
Verifica la password candidata rispetto all’hash memorizzato.
Versione: PHP 8.4; repository runtime, production runtime not attested
Sintassi
password_verify(#[SensitiveParameter] string $password, string $hash): boolVerifica la password candidata rispetto all’hash memorizzato. L’hash contiene sale, costo e algoritmo. Il controllo resistente agli attacchi temporali restituisce false in caso di mancata corrispondenza. Con bcrypt si applica anche in verifica il limite di 72 byte.
Firma
password_verify(#[SensitiveParameter] string $password, string $hash): bool
Output dell’esempio
[true,false]
Esempi
<?php
$hash=password_hash("Maple notes",PASSWORD_BCRYPT);
echo json_encode([password_verify("Maple notes",$hash),password_verify("maple notes",$hash)]);
Risultato
[true,false]