0.0.4-lts • Published 1 year ago

@fntools/password-hasher v0.0.4-lts

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

PasswordHasher

We usually use bcrypt and bcrypt.js in handling passwords but there are some promblems I have encounter which is speed and lightweightness so PasswordHasher is the way to go, it is built using pure javascript and only 1 file with only one dependencies PasswordHasher is developed to be a tool for freenet wallet

install

NPM

$ npm i @fntools/password-hasher --save 

YARN

$ yarn add @fntools/password-hasher

HOW TO INCLUDE IN YOUR PROJECT

// ESM 
import PasswordHasher from "@fntools/password-hasher";

// COMMONJS 
const password-hasher = require("@fntools/password-hasher");

USAGE

const Hasher = new PasswordHasher(layers:number);
/* layers is the times a password is going to be hashed */

// ONLY HAS TWO METHODS 
 [1] Hasher.hash(password);
 /* password => is a string password which is going to return promise  
    @returns Promise => hash string
   */
 [2] Hasher.compare(password,hash)
 /* password => a string which is a password 
   hash => is a hash string from hashing a password 
   @returns Promise => boolean || {
     error : true,
     reason : " password does not match"
   } ;

EXAMPLE

import PasswordHasher from "@fntools/password-hasher";
  const password = new PasswordHasher(15);

// hash 
password.hash("takataka").then((__hash:any) => {
  console.log(__hash)})

password.compare("takataka","2b77e37044d70a18be0236d5f57036899447bc5efec1f02409ea5a31d9068342").then((v:any) => {
  console.log(v);
} )

// 2b77e37044d70a18be0236d5f57036899447bc5efec1f02409ea5a31d9068342
// true

Developed By

Lowe Andaya

0.0.4-lts

1 year ago

0.0.3

1 year ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago