🛡 argon2 plugin for credential-plus
This package is thought to be used in conjunction with credential-plus
If you find a security flaw in this code, please report it.
$ npm install --save credential-plus-argon2
const credential = require('credential-plus');
credential.install(require('credential-plus-argon2'));
// Hash and verify with argon2 and default configs
credential.hash('We are all unicorns', {func: 'argon2'}, (err, hash) => {
console.log(hash);
//=> {"hash":"$argon2d$v=19$m=4096,t=3,p=1$i5VhaDYfYqSWWoG1uKVBbw$QHpzhFRYJZwIcogtSciXh0hbc8f91PyGBdtWSNocuiE","func":"argon2"}
credential.verify(hash, 'We are all unicorns', (match) =>{
console.log(match);
//=> true
})
});
Creates a new 'unique' hash from a password.
Type: string
The password to hash.
Type: object
Configurations for the hash function.
Type: number
Default: 0
The type option is flexible and accepts.
0
, 1
or 2
for Argon2d
, Argon2i
and Argon2id
respectively.
Type: number
Default: 3
The amount of computation realized and therefore the execution time, given in number of iterations.
Type: number
Default: 12
The memory usage, given in kibibytes.
Type: number
Default: 1
The number of parallel threads.
Type: number
Default: 32
The length of the generated hash.
Type: function
Called after the hash has been computed.
Type: object
Possible error thrown.
Type: object
The generated hash.
Determines whether or not the user's input matches the stored password.
Type: string
An hash generated from this package.
Type: string
User's input input.
Type: string
Called after the verification process has been computed.
Type: object
Possible error thrown.
Type: boolean
True if the hash computed for the input matches.
- Simone Primarosa - simonepri
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details.