Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<sodium_crypto_pwhash_strsodium_crypto_pwhash_str_verify>
^Sodium FunctionsLast updated: Mon, 26 Oct 2026

sodium_crypto_pwhash_str_needs_rehash

(PHP 7 >= 7.2.0, PHP 8)

sodium_crypto_pwhash_str_needs_rehash — Determine whether or not to rehash a password

Description

function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, int $memlimit): bool

Determine whether or not to rehash a password, based on the current hash opslimit and memlimit.

Parameters

password

Password hash

opslimit

Configured opslimit; see sodium_crypto_pwhash_str()

memlimit

Configured memlimit; see sodium_crypto_pwhash_str()

Return Values

Returns true if the provided memlimit/opslimit do not match what's stored in the hash. Returns false if they match.


<sodium_crypto_pwhash_strsodium_crypto_pwhash_str_verify>
^Sodium FunctionsLast updated: Mon, 26 Oct 2026