PHPackages                             paragonie/argon2-refiner - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. paragonie/argon2-refiner

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

paragonie/argon2-refiner
========================

Calculate the appropriate Argon2id parameters for the local hardware environment.

v0.3.0(5y ago)253521[1 issues](https://github.com/paragonie/argon2-refiner/issues)ISCPHPPHP &gt;=7.3

Since Jul 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/paragonie/argon2-refiner)[ Packagist](https://packagist.org/packages/paragonie/argon2-refiner)[ RSS](/packages/paragonie-argon2-refiner/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (2)Versions (7)Used By (0)

Argon2 Refiner
==============

[](#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://camo.githubusercontent.com/42e3f03fbf9f5b49cc0655d2af26631917f4e32cb348fcbe552eed271b2bf509/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f6172676f6e322d726566696e65722f762f737461626c65)](https://packagist.org/packages/paragonie/argon2-refiner)[![Latest Unstable Version](https://camo.githubusercontent.com/68916eeb6b2fd9aa6a7e0fb5e341420c34ab6f81d53cc71e4c80c785124b67b0/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f6172676f6e322d726566696e65722f762f756e737461626c65)](https://packagist.org/packages/paragonie/argon2-refiner)[![License](https://camo.githubusercontent.com/7b62252254179a8fc1cc75d558d4571c4366b66a1cbc987301ffd745b3e011fa/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f6172676f6e322d726566696e65722f6c6963656e7365)](https://packagist.org/packages/paragonie/argon2-refiner)[![Downloads](https://camo.githubusercontent.com/cba7b828005be73d6699b278f5b4a3e6d9aba36028e614affdfe6688195e0f73/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70617261676f6e69652f6172676f6e322d726566696e65722e737667)](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
-------------------------

[](#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
------------------

[](#usage-instructions)

### Command Line

[](#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

[](#object-oriented-api)

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

```
