New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

wmcrypt

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

wmcrypt

A lightweight bcrypt alternative for password hashing and verification

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

wmcrypt

A lightweight alternative to bcrypt for password hashing and verification using Node.js built-in crypto module.

Features

  • Simple API for password hashing and verification
  • Uses PBKDF2 with SHA-512 for strong security
  • No external dependencies (uses Node.js crypto)
  • Fast and easy to use
  • Suitable for authentication systems

Installation

Install via npm (local usage):

npm install ./wmcrypt

Or if published to npm:

npm install wmcrypt

Usage

Import

const { hashPassword, verifyPassword } = require('wmcrypt');

Hash a Password

const password = 'mySecret123';
const hashed = hashPassword(password);
console.log('Hashed:', hashed);

Verify a Password

const isMatch = verifyPassword('mySecret123', hashed);
console.log('Password match:', isMatch); // true

const isMismatch = verifyPassword('wrongPass', hashed);
console.log('Password match:', isMismatch); // false

Example

See test/wmcrypt.test.js for a complete example:

const { hashPassword, verifyPassword } = require('../src/index');

const password = 'mySecret123';
const hashed = hashPassword(password);

console.log('Hashed:', hashed);
console.log('Match:', verifyPassword(password, hashed)); // true
console.log('Mismatch:', verifyPassword('wrongPass', hashed)); // false

API Reference

hashPassword(password: string): string

  • Hashes the given password with a random salt.
  • Returns a string in the format salt:hash.

verifyPassword(password: string, storedHash: string): boolean

  • Verifies the password against the stored hash.
  • Returns true if the password matches, otherwise false.

How It Works

  • Generates a random salt for each password.
  • Uses PBKDF2 with SHA-512, 100,000 iterations, and a 64-byte key.
  • Stores salt and hash together, separated by a colon.

Project Structure

License

MIT

Keywords

hash

FAQs

Package last updated on 04 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts