ldap-ssha
v0.0.2
Published
LDAP SSHA hashing library.
Downloads
3
Readme
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!');
}