https://github.com/wuriyanto48/nodejs-pbkdf2
a simple and fast module for hash and verify a password using NodeJs PBKDF2
https://github.com/wuriyanto48/nodejs-pbkdf2
crypto nodejs nodejs-modules password-hash pbkdf2
Last synced: 16 days ago
JSON representation
a simple and fast module for hash and verify a password using NodeJs PBKDF2
- Host: GitHub
- URL: https://github.com/wuriyanto48/nodejs-pbkdf2
- Owner: wuriyanto48
- License: mit
- Created: 2017-04-24T05:22:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-08-16T04:35:07.000Z (about 4 years ago)
- Last Synced: 2025-02-01T10:02:35.211Z (9 months ago)
- Topics: crypto, nodejs, nodejs-modules, password-hash, pbkdf2
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/nodejs-pbkdf2
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PBKDF2 Node JS
[](https://travis-ci.org/wuriyanto48/nodejs-pbkdf2)
[](https://github.com/wuriyanto48/nodejs-pbkdf2/actions/workflows/ci.yml)# Usage
- Install first
```shell
$ npm install nodejs-pbkdf2
```- Set up the config:
```javascript
let config = {
digestAlgorithm: 'sha1',
keyLen: 64,
saltSize: 64,
iterations: 15000
};
```- Hashing a Password
```javascript
'use strict';const Pbkdf2 = require('nodejs-pbkdf2');
const config = {
digestAlgorithm: 'sha1',
keyLen: 64,
saltSize: 64,
iterations: 15000
};let pbkdf2 = new Pbkdf2(config);
pbkdf2.hashPassword('12345', (err, cipherText, salt) => {
console.log(cipherText);
console.log(salt);
});```
- Verify a Password
```javascript
'use strict';const Pbkdf2 = require('nodejs-pbkdf2');
const config = {
digestAlgorithm: 'sha1',
keyLen: 64,
saltSize: 64,
iterations: 15000
};let pbkdf2 = new Pbkdf2(config);
pbkdf2.hashPassword('12345', (err, cipherText, salt) => {
pbkdf2.isValidPassword('12345', cipherText, salt).then((isValid) => {
console.log(isValid);
});
});```
# How to Contribute
- Fork first
- Clone to your local machine
```shell
$ git clone https://github.com//nodejs-pbkdf2.git
```- Install dependencies
```shell
$ npm install
```- Create a new branch
```shell
$ git checkout -b feature/your-feature-branch
```- Run test
```shell
$ npm test
```- Push to your repository
```shell
$ git push -u origin feature/your-feature-branch
```- Hit the Pull Request