npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ldap-passwords

v3.0.3

Published

ldap-passwords offers secure password hashing and verification using LDAP password algorithms.

Downloads

38

Readme

✨ Features

  • Encrypt a plain text password with Ldap passwords algorithm.
  • Verify encrypted passwords.
  • No external dependencies.

🪄 Supported Algorithms

  • SHA512 CRYPT
  • SSHA
  • MD5

🚀 Setup

  1. Install with your favorite package manager:
    • pnpm : pnpm i ldap-passwords
    • npm : npm i ldap-passwords
    • yarn : yarn add ldap-passwords
    • bun : bun add ldap-passwords

⚡️ SHA512 CRYPT

  1. Import the function into your project:
import { sha512Crypt, verifySha512Crypt } from 'ldap-passwords'
  1. Encrypt a plain text password using sha512 and a random salt:
const encryptedPassword = sha512Crypt('mySuperSecretPassword')
// return {CRYPT}$6$NQgPVC0up/oNVCb4$Aduz92Zfo/PFDE/XhvA3QmSqHquqdNiCdZvc9N5/UTpEUepMdd/6Mq/TeoM07wvyxHpg8ELGVzTWZt2e7Z9LY/
  1. Encrypt a plain text password using sha512 and a custom salt:
    The maximum length of salt is 16 characters
const encryptedPassword = sha512Crypt('mySuperSecretPassword', 'myDopeCustomSalt')
// return {CRYPT}$6$myDopeCustomSalt$4ENRn.vwcs09z0fjr6Jt3NMOFVkn.p9v7ilDcK/CwRnQm48Y5HawkiGivh4gBTLwSY4SQNfCAe05E1nCTpZ0u.
  1. Validate your plain text password with a sha512 encrypted password:
    The sha512 password can be either a single string or an array of strings. The plain text password will be compared to each sha512 password and the function will return true if any of them matches
const isValid = verifySha512Crypt('mySuperSecretPassword', arrayOfSha512Passwords)
// return true or false

💡 SSHA

  1. Import the function into your project:
import { ssha, verifySSHA } from 'ldap-passwords'
  1. Encrypt a plain text password using SSHA:
const encryptedPassword = ssha('mySuperSecretPassword')
// return {SSHA}sTIysPunEI4boe6OwgQO+/tRZao2OWJIbDMvY0g2UlM=
  1. Validate your plain text password with a MD5 encrypted password:
    The SSHA password can be either a single string or an array of strings. The plain text password will be compared to each SSHA password and the function will return true if any of them matches
const isValid = verifySSHA('mySuperSecretPassword', arrayOfSSHAPasswords)
// return true or false

💥 MD5

  1. Import the function into your project:
import { md5, verifyMD5 } from 'ldap-passwords'
  1. Encrypt a plain text password using md5:
const encryptedPassword = md5('mySuperSecretPassword')
// return {MD5}aTVgaG9NWR2N1eNABkQgYQ==
  1. Validate your plain text password with a MD5 encrypted password:
    The MD5 password can be either a single string or an array of strings. The plain text password will be compared to each MD5 password and the function will return true if any of them matches
const isValid = verifyMD5('mySuperSecretPassword', arrayOfMD5Passwords)
// return true or false

🔍 Verify All

  1. Import the function into your project:
import { ldapVerifyAll } from 'ldap-passwords'
  1. Validate your plain text password with a MD5, SSHA or SHA512 encrypted password: The hashed password can be either a single string or an array of strings. The plain text password will be compared to each hashed password and the function will return true if any of them matches
const isValid = ldapVerifyAl('mySuperSecretPassword', arrayOfHashedPasswords)
// return true or false

📝 License

Copyright © 2024 Gabriel 'DethDKN' Rosa
This project is under MIT license