2.1.2 • Published 4 months ago

ldap-sha512 v2.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

✨ 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

2.1.2

4 months ago

2.1.1

4 months ago

2.1.0

4 months ago

2.0.0

4 months ago

1.1.0

6 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago