crutch / hash-native
Native PHP hash implementation
v1.0.0
2023-01-19 11:44 UTC
Requires
- php: ^7.4 || ^8.0
- crutch/hash: ^1.0
Provides
This package is not auto-updated.
Last update: 2024-12-20 06:06:27 UTC
README
Hash interface
Install
composer require crutch/hash-native
Using
<?php $hasher = new \Crutch\NativeHash\BcryptHash(10); // one argument cost // or $hasher = new \Crutch\NativeHash\Argon2IHash(65536, 4, 1); // arguments: memoryCost, timeCost, threads // or $hasher = new \Crutch\NativeHash\Argon2IdHash(65536, 4, 1); // arguments: memoryCost, timeCost, threads $value = 'password'; $hash = $hasher->hash($value); var_dump($hasher->verify($hash, $value)); // true var_dump($hasher->isNeedRehash($hash)); // false