CKTIS / PHP
password_needs_rehash()
Uspoređuje algoritam i trošak pohranjenog sažetka lozinke sa željenim postavkama.
Verzija: PHP 8.4; repository runtime, production runtime not attested
Sintaksa
password_needs_rehash(string $hash, string|int|null $algo, array $options = []): boolUspoređuje algoritam i trošak pohranjenog sažetka lozinke sa željenim postavkama. Razlika vraća true bez provjere lozinke. Nakon uspješne provjere iz unesene lozinke izradite i pohranite novi sažetak.
Potpis
password_needs_rehash(string $hash, string|int|null $algo, array $options = []): bool
Ispis primjera
[false,true]
Primjeri
<?php
$stored=password_hash("maple notes",PASSWORD_BCRYPT,["cost"=>12]);
echo json_encode([password_needs_rehash($stored,PASSWORD_BCRYPT,["cost"=>12]),password_needs_rehash($stored,PASSWORD_BCRYPT,["cost"=>13])]);
Rezultat
[false,true]