qing7777/hash

Hyperf-ext hash Package

v1.0.0 2020-03-31 02:08 UTC

This package is auto-updated.

Last update: 2024-09-09 01:34:50 UTC


README

Require this package with composer:

composer require qing7777/hash

Configuration

To use your own settings, publish config.

php bin/hyperf.php vendor:publish qing7260/hash

config/autoload/hash.php

获取Hash

use Qing7777\Hash\Hash;

$str = '12345';

$encryptedStr = Hash::make($str);

or

use Hyperf\Utils\ApplicationContext;
use Qing7777\Hash\HashInterface;

$str = '12345';

$HashInterface = ApplicationContext::getContainer()->get(HashInterface::class);

$HashInterface->make($str);

使用指定Hash算法加密

use Qing7777\Hash\Hash;

$str = '12345';

// Supported: "bcrypt", "argon"

$encryptedStr = Hash::driver("argon")->make($str);