Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 334 Bytes

File metadata and controls

18 lines (13 loc) · 334 Bytes

Password Hashing

<?php

declare(strict_types=1);

use CommonPHP\Security\NativePasswordHasher;

$hasher = new NativePasswordHasher();
$hash = $hasher->hash($newPassword);

if ($hasher->verify($submittedPassword, $hash)) {
    if ($hasher->needsRehash($hash)) {
        $hash = $hasher->hash($submittedPassword);
    }
}