This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

ldap-sha512
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

Ldap-sha512

Ldap sha512-crypt password generator for node

npm License Gitmoji rosa.dev.br

✨ Features

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

🚀 Setup

  1. Install with your favorite package manager:

    • pnpm : pnpm i ldap-sha512
    • npm : npm i ldap-sha512
    • yarn : yarn add ldap-sha512
    • bun : bun add ldap-sha512
  2. Import the function into your project:

import { sha512Crypt, verifySha512 } from 'ldap-sha512'

⚡️ Usage

  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 = verifySha512('mySuperSecretPassword', arrayOfSha512Passwords)
// return true or false

📝 License

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

Package Sidebar

Install

npm i ldap-sha512

Weekly Downloads

2

Version

2.1.2

License

MIT

Unpacked Size

39.6 kB

Total Files

8

Last publish

Collaborators

  • dethdkn