npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

passwuert

v3.1.1

Published

password save and validation

Downloads

15

Readme

passwuert

Hash password and compare to hashed.

Why

Hash passwords to not store passwords in plaintext. Having passwords in plaintext is risky, because they can be leaked as soon as the system or the administrator is compromised. Also it is forbidden to store password in plaintext files.

To still be able to verify a password we simply hash it again with the same function. If the result is the same then it means the inputs were the same.

We add salt, to slow down potential hackers. The salt is random, so that if 2 people use the same password, the data will not look the same.

Installation

npm i passwuert

Usage

See example

passwuert.js

import {
    hashPasswordWithRandomSalt,
    comparePasswordToHashed,
} from "passwuert"; // async
// or from "passwuert/lib/passwuertNodeLegacy.js" // sync



// deno
import {
    hashPasswordWithRandomSalt,
    comparePasswordToHashed,
} from "https://unpkg.com/passwuert/lib/passwuert.js"; // async

// password is a string
// digestname is optional, default sha512 or SHA-512
// keylen is optional, the length of the result hash, default 16
// use async keyword for async version
const { hash, salt, iterations } = hashPasswordWithRandomSalt(password, digestName, keylen);
// again digestName and keylen are optional but should be the same as used above
const samePassword = comparePasswordToHashed(password, {hash, salt, iterations}, digestName, keylen)

digestname choices

  • BLAKE2b512
  • BLAKE2s256
  • MD4
  • MD5
  • MD5-SHA1
  • MDC2
  • RIPEMD160
  • SHA1
  • SHA224
  • SHA256
  • SHA3-224
  • SHA3-256
  • SHA3-384
  • SHA3-512
  • SHA384
  • SHA512
  • SHA512-224
  • SHA512-256
  • SHAKE128
  • SHAKE256
  • SM3

About

Difference between passwuertNodeLegacy.js and passwuertNode.js

passwuertNode.js imports passwuert.js which uses webcrypto. passwuertNodeLegacy uses custom Node.js specific functions that existed before and the functions are sync.

Difference with bcrypt

  • Does not depend on Python or C++
  • Uses modern WebCrypto API
  • Works in the browser and Deno too
  • hash, salt and iterations are returned as 3 separate items
  • Requires Node18+

Changelog

Changelog

License

CC0