# ldap-sha512

> Ldap sha512-crypt password generator for node

Latest version **2.1.2** (published 2024-01-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ldap-sha512
pnpm add ldap-sha512
yarn add ldap-sha512
bun add ldap-sha512
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2024-01-10 |
| First published | 2023-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 38.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gabriel 'DethDKN' Rosa |
| Maintainers | dethdkn |
| Keywords | sha512, ldap, crypt, password, hash, $6$ |

## Links

- npm: https://www.npmjs.com/package/ldap-sha512
- Homepage: https://ldap-passwords.com
- Issues: https://github.com/dethdkn/ldap-sha512/issues
- npm.io page: https://npm.io/package/ldap-sha512

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2024-01-10
- 2.1.1 — 2024-01-08
- 2.1.0 — 2024-01-08
- 2.0.0 — 2024-01-07
- 1.1.0 — 2023-11-10
- 1.0.5 — 2023-07-10
- 1.0.4 — 2023-07-10
- 1.0.3 — 2023-07-07
- 1.0.2 — 2023-07-05
- 1.0.0 — 2023-07-05

## README

<a href="http://ldap-passwords.com/">
<h1 align="center">Ldap-sha512</h1>
</a>
<p align="center">Ldap sha512-crypt password generator for node</p>
<p align="center">
   <a href="https://www.npmjs.com/package/ldap-sha512">
      <img src="https://img.shields.io/npm/dt/ldap-sha512?color=%23c12127&label=downloads&logo=npm" alt="npm"/>
   </a>
   <a href="https://github.com/dethdkn/ldap-sha512/blob/main/LICENSE">
      <img src="https://img.shields.io/github/license/dethdkn/ldap-sha512?color=%233da639&logo=open%20source%20initiative" alt="License"/>
  </a>
   <a href="https://gitmoji.dev">
      <img src="https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67" alt="Gitmoji"/>
   </a>
   <a href="https://rosa.dev.br">
      <img src="https://img.shields.io/badge/check me!-👻-F28AA9" alt="rosa.dev.br"/>
   </a>
</p>

## ✨ 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:
```ts
import { sha512Crypt, verifySha512 } from 'ldap-sha512'
```

## ⚡️ Usage

1. Encrypt a plain text password using sha512 and a random salt:
```ts
const encryptedPassword = sha512Crypt('mySuperSecretPassword')
// return {CRYPT}$6$NQgPVC0up/oNVCb4$Aduz92Zfo/PFDE/XhvA3QmSqHquqdNiCdZvc9N5/UTpEUepMdd/6Mq/TeoM07wvyxHpg8ELGVzTWZt2e7Z9LY/
```

2. Encrypt a plain text password using sha512 and a custom salt:\
**The maximum length of salt is 16 characters**
```ts
const encryptedPassword = sha512Crypt('mySuperSecretPassword', 'myDopeCustomSalt')
// return {CRYPT}$6$myDopeCustomSalt$4ENRn.vwcs09z0fjr6Jt3NMOFVkn.p9v7ilDcK/CwRnQm48Y5HawkiGivh4gBTLwSY4SQNfCAe05E1nCTpZ0u.
```

3. 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**
```ts
const isValid = verifySha512('mySuperSecretPassword', arrayOfSha512Passwords)
// return true or false
```

## 📝 License

Copyright © 2024 [Gabriel 'DethDKN' Rosa](https://github.com/dethdkn)\
This project is under [MIT license](https://github.com/dethdkn/ldap-sha512/blob/main/LICENSE)

---
_Source: https://npm.io/package/ldap-sha512 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
