项目作者: wuriyanto48

项目描述 :
a simple and fast module for hash and verify a password using NodeJs PBKDF2
高级语言: JavaScript
项目地址: git://github.com/wuriyanto48/nodejs-pbkdf2.git
创建时间: 2017-04-24T05:22:57Z
项目社区:https://github.com/wuriyanto48/nodejs-pbkdf2

开源协议:MIT License

下载


PBKDF2 Node JS

Build Status
nodejs-pbkdf2 CI

Usage

  • Install first
  1. $ npm install nodejs-pbkdf2
  • Set up the config:
  1. let config = {
  2. digestAlgorithm: 'sha1',
  3. keyLen: 64,
  4. saltSize: 64,
  5. iterations: 15000
  6. };
  • Hashing a Password
  1. 'use strict';
  2. const Pbkdf2 = require('nodejs-pbkdf2');
  3. const config = {
  4. digestAlgorithm: 'sha1',
  5. keyLen: 64,
  6. saltSize: 64,
  7. iterations: 15000
  8. };
  9. let pbkdf2 = new Pbkdf2(config);
  10. pbkdf2.hashPassword('12345', (err, cipherText, salt) => {
  11. console.log(cipherText);
  12. console.log(salt);
  13. });
  • Verify a Password
  1. 'use strict';
  2. const Pbkdf2 = require('nodejs-pbkdf2');
  3. const config = {
  4. digestAlgorithm: 'sha1',
  5. keyLen: 64,
  6. saltSize: 64,
  7. iterations: 15000
  8. };
  9. let pbkdf2 = new Pbkdf2(config);
  10. pbkdf2.hashPassword('12345', (err, cipherText, salt) => {
  11. pbkdf2.isValidPassword('12345', cipherText, salt).then((isValid) => {
  12. console.log(isValid);
  13. });
  14. });

How to Contribute

  • Fork first
  • Clone to your local machine

    1. $ git clone https://github.com/<your-github-username>/nodejs-pbkdf2.git
  • Install dependencies

    1. $ npm install
  • Create a new branch

    1. $ git checkout -b feature/your-feature-branch
  • Run test

    1. $ npm test
  • Push to your repository

    1. $ git push -u origin feature/your-feature-branch
  • Hit the Pull Request