0.0.2 • Published 10 years ago

co-crypto-saltedhash v0.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

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 = require('co-crypto-saltedhash');
	var m = yield auth.generatedSaltedHash('password');
	console.log(
		m.get('salt')
		, m.get('hash')
		, m.get('iterations')
	);
	
	var authenticated = yield auth.validatePassword(
		'password'
		, m.get('salt') // just strings
		, m.get('hash') // can come from anywhere
	);

	// here we override a default configuration item: 'iterations'
	var auth = require('co-crypto-saltedhash')({
		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,

NAMEDEFAULTTYPE
encoding'base64'String
iterations100000Int
output_length20Int
salt_length20Int

AUTHOR

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago