A phpass portable hashing function compatible with wordpress passwords (TypeScript port)
npm install @n0uur/wordpress-hash-nodeWordpress 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Ă .
``bash`
npm install @n0uur/wordpress-hash-node
`javascript
const { HashPassword, CheckPassword } = require("@n0uur/wordpress-hash-node");
const password = "testPassword";
const hash = HashPassword(password);
const checked = CheckPassword(password, hash); // This will return true
`
`typescript
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 true
`
Generates a WordPress-compatible hash for the given password.
- Parameters:
- password (string): The password to hash
- Returns: The hashed password string
Verifies if a password matches the stored hash.
- Parameters:
- password (string): The password to verifystored_hash
- (string): The hash to compare againsttrue
- Returns: if the password matches, false` otherwise
GPL