0.0.2 • Published 2 years ago

ldap-ssha v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

LDAP SSHA

LDAP salted password hashing library. It supports all of the "sha" variants returned by crypto.getHashes().

Install

npm install -s ldap-ssha

Usage

const ldapSsha = require('ldap-ssha');

// LdapSssha.hash(algorithm, secret, salt)
let saltedHash = ldapSsha.hash('SSHA', 'foo');

// LdapSsha.verify(secret, saltedHash)
if (!ldapSsha.verify('bar', saltedHash)) {
	throw new Error('Invalid secret!');
}

let saltedHash512 = ldapSsha.hash('SSHA512', 'foo', 'optional salt');
if (ldapSsha.verify('foo', saltedHash512)) {
	console.log('Secret is valid!');
}
0.0.2

2 years ago

0.0.1

2 years ago