@n0uur/wordpress-hash-node
v2.0.0
Published
A phpass portable hashing function compatible with wordpress passwords (TypeScript port)
Maintainers
Readme
@n0uur/wordpress-hash-node
Wordpress hashes (phpass library portable hashes) port for Node.js with TypeScript support.
Based on phpass for PHP 5 or greater.
Original Author Credit: This package is a TypeScript port of wordpress-hash-node by Alex Albalà.
Installation
npm install @n0uur/wordpress-hash-nodeUsage
JavaScript (CommonJS)
const { HashPassword, CheckPassword } = require("@n0uur/wordpress-hash-node");
const password = "testPassword";
const hash = HashPassword(password);
const checked = CheckPassword(password, hash); // This will return trueTypeScript
import { HashPassword, CheckPassword } from "@n0uur/wordpress-hash-node";
const password = "testPassword";
const hash: string = HashPassword(password);
const checked: boolean = CheckPassword(password, hash); // This will return trueAPI
HashPassword(password: string): string
Generates a WordPress-compatible hash for the given password.
- Parameters:
password(string): The password to hash
- Returns: The hashed password string
CheckPassword(password: string, stored_hash: string): boolean
Verifies if a password matches the stored hash.
- Parameters:
password(string): The password to verifystored_hash(string): The hash to compare against
- Returns:
trueif the password matches,falseotherwise
License
GPL
