Skip to content

prokopschield/doge-passwd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

doge-passwd

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

methods

Regular - hash(), verify()

Hex - hash_hex(), verify_hex()

Always use the correct verify() function!

length

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!

Frontend Authentication

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published