crutch / hash-native
原生 PHP hash 实现
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-09-13 04:49:26 UTC
README
哈希接口
安装
composer require crutch/hash-native
使用
<?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