Password Hashing
Secure password hashing utilities using argon2, bcryptjs, scrypt, and pbkdf2.
Installation Guide
Install the component using the servercn CLI:
npx servercn-cli@latest add password-hashing You will be prompted to select a password hashing strategy:
The CLI will then automatically configure the component based on your selected strategy.
Basic Implementation
1. argon2
A modern, memory-hard algorithm designed to resist GPU and ASIC attacks. Best choice for new applications
2. bcryptjs
A widely adopted and battle-tested algorithm with configurable cost factor. Suitable for legacy compatibility.
3. scrypt
A memory-intensive algorithm that significantly increases the cost of brute-force attacks.
4. pbkdf2
A standards-based algorithm included in Node.js core. Useful when external dependencies are not allowed.