paragonie/argon2-refiner 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

paragonie/argon2-refiner

Composer 安装命令:

composer require paragonie/argon2-refiner

包简介

Calculate the appropriate Argon2id parameters for the local hardware environment.

README 文档

README

Build Status Latest Stable Version Latest Unstable Version License Downloads

Easily and effectively benchmark the real time to perform Argon2id password hashes on your machine.

Warning: This might take many seconds or minutes to complete.

Installation Instructions

Use Composer.

composer require paragonie/argon2-refiner

Alternatively, you can install this with Git.

git clone https://github.com/paragonie/argon2-refiner
cd argon2-refiner
composer install

Usage Instructions

Command Line

Run the bundled benchmark script like so:

# Installed via Composer:
vendor/bin/benchmark [milliseconds=500] [tolerance=250]

# Installed via Git:
composer run-benchmarks [milliseconds=500] [tolerance=250]

The expected output will look something like this:

$ vendor/bin/benchmark 125
 Recommended Argon2id parameters:
 	       Memory cost (sodium): 79691776
 	Memory cost (password_hash): 77824
 	                  Time cost: 3
 
 Real time: 124ms

This means that if you set your Argon2id mem_cost to 79691776 bytes (or 77824 KiB, which is what password_hash() expects) and the time_cost to 3, you will get the closest parameters that take about 125 milliseconds to process (in this example, it took 124).

Object-Oriented API

You can fine-tune your min/max costs to search within from the object by invoking the appropriate methods.

<?php
use ParagonIE\Argon2Refiner\ParameterRecommender;

$refiner = (new ParameterRecommender(125))
    ->setMinMemory(1 << 20)
    ->setMaxMemory(1 << 31)
    ->setMinTime(2)
    ->setMaxTime(4)
    ->setTolerance(25);

$results = $refiner->runBenchmarks();

The runBenchmarks() method returns a two-dimensional array of arrays. Each child array consists of the following data:

  • mem_cost (int) -- Candidate parameter
  • time_cost (int) -- Candidate parameter
  • bench_time (int) -- Milliseconds elapsed in Argon2id calculation

From this data, you can devise your own strategy for selecting which parameters set is most suitable for your environment.

统计信息

  • 总下载量: 352
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 25
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 25
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: ISC
  • 更新时间: 2019-07-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固