Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vanilla-icecream/pbkdf2-passworder
Password hashing and verification with PBKDF2 using the recommended configuration by NIST.
https://github.com/vanilla-icecream/pbkdf2-passworder
password pbkdf2
Last synced: 6 days ago
JSON representation
Password hashing and verification with PBKDF2 using the recommended configuration by NIST.
- Host: GitHub
- URL: https://github.com/vanilla-icecream/pbkdf2-passworder
- Owner: Vanilla-IceCream
- License: mit
- Created: 2023-05-16T01:35:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-25T09:01:57.000Z (over 1 year ago)
- Last Synced: 2025-01-06T13:44:13.536Z (14 days ago)
- Topics: password, pbkdf2
- Language: TypeScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pbkdf2-passworder
Password hashing and verification with PBKDF2 using the recommended configuration by NIST.
## Installation
Install `pbkdf2-passworder` with your favorite package manager:
```sh
$ npm i pbkdf2-passworder
# or
$ yarn add pbkdf2-passworder
# or
$ pnpm i pbkdf2-passworder
# or
$ bun add pbkdf2-passworder
```## Usage
The `pbkdf2-passworder` package provides a convenient way to hash and verify passwords using the PBKDF2 algorithm. Follow the steps below to get started.
1. Import the necessary functions from the `pbkdf2-passworder` package:
```ts
import pbkdf2 from 'pbkdf2-passworder';
```2. Hashing a Password:
```ts
const password = '123456';
const hashedPassword = await pbkdf2.hash(password);
```The `hash` function takes a password as input and returns a Promise that resolves to the hashed password. The resulting hashed password is a string.
3. Comparing a Password:
```ts
const inputPassword = '123456';
const isMatch = await pbkdf2.compare(inputPassword, hashedPassword);
```The `compare` function takes an input password and a hashed password as input and returns a Promise that resolves to a boolean value. It indicates whether the input password matches the hashed password.
If the input password matches the hashed password, the result will be `true`. Otherwise, it will be `false`.
That's it! You can now use `pbkdf2-passworder` to securely hash and verify passwords using the PBKDF2 algorithm in your Node.js applications.