Skip to content

A minimal (static) class for hashing and verifying passwords

License

Notifications You must be signed in to change notification settings

basteyy/minimal-hash-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minimal-hash-wrapper

A minimal (static) class for hashing and verifying passwords

Setup

composer require basteyy/minimal-hash-wrapper

Usage

Create the hash of a password

$userPassword = 'foobar';
$userPasswordHashed = \basteyy\MinimalHashWrapper\MinimalHashWrapper::getHash($userPassword);

Compare hash and a password

if(\basteyy\MinimalHashWrapper\MinimalHashWrapper::compare(
    $_POST['password'], // From a form for example
    $user->password // From a database for example
)) {
    echo 'Password was correct. Welcome back user!';
} else {
    echo 'Okay cowboy .. something is wrong';
}

About

A minimal (static) class for hashing and verifying passwords

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages