co-crypto-saltedhash
DESCRIPTION
A simple module to generate salted hashes.
Configure it with a constructor or run it with static defaults.
SYNOPSIS
// most basic syntax var auth = ; var m = auth; console; var authenticated = auth; // here we override a default configuration item: 'iterations' var auth = iterations: 5000 ;
GENERATOR FUNCTIONS
generateSaltedHash( password, [salt] )
Generates a salted hash of length 'output_length' using the optionally provided 'salt'. If no salt is provided it generates a salt of the byte size set in 'salt_length'. Iterations are configurable in the constructor.
validatePassword( password, salt, salted_hash )
Generates a new salted hash using provided password and salt. Compares result to salted_hash and returns true or false.
DEFAULTS
If porting to another language, the defaults used in this module are,
NAME | DEFAULT | TYPE |
---|---|---|
encoding | 'base64' | String |
iterations | 100000 | Int |
output_length | 20 | Int |
salt_length | 20 | Int |