node-hash-password
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

NODE-HASH-PASSWORD

GitHub top language Made by Repository size GitHub last commit


📖 Description :

This package hashes plain text, passwords using algorithms.

  • keccak256 (max length 66)
  • sha256 (max length 66)
  • sha512 (max length 130)

💻 Step to install :

npm install --production node-hash-password

✏️ Example :

Typescript

import { hashWithKeccak256, hashWithSha256, hashWithSha512, compareHashAndPassword } from "node-hash-password";

ESM (import)

import { hashWithKeccak256, hashWithSha256, hashWithSha512, compareHashAndPassword } from "node-hash-password";

CommonJs (require)

const { hashWithKeccak256, hashWithSha256, hashWithSha512, compareHashAndPassword } = require("node-interval-return");

Usage

const { hashWithKeccak256, compareHashAndPassword } = require("node-hash-password");

const resultHash = hashWithKeccak256({ password: "my name is damar" }); // 0x334700c8ae0754b6660291b12ae7b663531431bbab1ebc185a45ce31b344d927

// try compare pure password with hash method keccak256
const resultCompare = compareHashAndPassword({
  method: "keccak256",
  hash: resultHash,
  password: "my name is damar",
});
console.log(resultCompare); // true

full example see here

🧾 Pre-Requisistes :

node.js

📝 License :

Licensed under the MIT License.

Package Sidebar

Install

npm i node-hash-password

Weekly Downloads

9

Version

1.2.4

License

MIT

Unpacked Size

10.3 kB

Total Files

7

Last publish

Collaborators

  • damartripamungkas