Socket
Socket
Sign inDemoInstall

ldap-sha512

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ldap-sha512

Ldap sha512-crypt password generator for node


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
38.7 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 10 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc