Generate strong password hashes easily.
import { hash, verify } from 'doge-passwd';
let password = `some_user_input`;
let hash_length = 64;
// Create hash, looks like this: yBZnekfk3zlGhJE78~0vkGtvpfC6EOnFIWAs9YasaOqRuOHMECZgWQe~7J8N4TWV
let hashed = hash(password, hash_length);
// Max length is 80, there is no lower bound on length, but more bytes = more security
// Longer hashes will generate incorrectly, and trying to verify() them will yield chaos
// Hash will always only use SQL-safe URL-safe characters, /[0-9a-z~_]/i
console.log(verify(password, hashed)); // true
Regular - hash(), verify()
Hex - hash_hex(), verify_hex()
Always use the correct verify() function!
For regular hashes, length must a multiple of 8, <= 80.
For hex hashes, length must be a multiple of 2, <= 128.
Longer length = more security!
You can use this package for frontend authentication.
It is likely not a good idea.
However, if your database does get leaked, doge-passwd hashes will be much harder to crack than, for example, a simple SHA-256.