Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paragonie/argon2-refiner
Generate Parameter Recommendations for Argon2id in PHP 7.3+
https://github.com/paragonie/argon2-refiner
Last synced: 3 months ago
JSON representation
Generate Parameter Recommendations for Argon2id in PHP 7.3+
- Host: GitHub
- URL: https://github.com/paragonie/argon2-refiner
- Owner: paragonie
- License: other
- Created: 2019-07-09T17:33:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-19T03:01:36.000Z (over 3 years ago)
- Last Synced: 2024-07-19T03:06:51.110Z (4 months ago)
- Language: PHP
- Homepage: https://paragonie.com/software
- Size: 15.6 KB
- Stars: 25
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Argon2 Refiner
[![Build Status](https://github.com/paragonie/argon2-refiner/actions/workflows/ci.yml/badge.svg)](https://github.com/paragonie/argon2-refiner/actions)
[![Latest Stable Version](https://poser.pugx.org/paragonie/argon2-refiner/v/stable)](https://packagist.org/packages/paragonie/argon2-refiner)
[![Latest Unstable Version](https://poser.pugx.org/paragonie/argon2-refiner/v/unstable)](https://packagist.org/packages/paragonie/argon2-refiner)
[![License](https://poser.pugx.org/paragonie/argon2-refiner/license)](https://packagist.org/packages/paragonie/argon2-refiner)
[![Downloads](https://img.shields.io/packagist/dt/paragonie/argon2-refiner.svg)](https://packagist.org/packages/paragonie/argon2-refiner)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](https://getcomposer.org/download).
```
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
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 calculationFrom this data, you can devise your own strategy for selecting which
parameters set is most suitable for your environment.