0.1.1 • Published 9 months ago

simple-hash-password v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

simple-hash-password

npm version license

A simple TypeScript library for hashing passwords, verifying hashed passwords, and generating random passwords. This package leverages the Web Crypto API to provide secure password hashing.

Features

  • Hash passwords using various algorithms (SHA-1, SHA-256, SHA-384, SHA-512).
  • Verify hashed passwords.
  • Generate secure random passwords.

Installation

You can install the package via npm:

npm install simple-hash-password

Usage

import { hash, verify, generatePassword } from "simple-hash-password";

const password = "yourSecurePassword123";
const hashedPassword = await hash(password, { algorithm: "SHA-256" });
console.log(`Hashed Password: ${hashedPassword}`);

const isValid = await verify(password, hashedPassword, { algorithm: "SHA-256" });
console.log(`Password is valid: ${isValid}`);

const newPassword = generatePassword({ length: 18 }); // Length should be a multiple of 3
console.log(`Generated Password: ${newPassword}`);
0.1.1

9 months ago

0.1.0

9 months ago