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

@rabbit-company/argon2id

v2.0.0

Published

Argon2id hash function

Downloads

8

Readme

Argon2id-WASM

Argon2id implementation in JavaScript (ES6, WASM, Rust).

Usage

1. Download library

npm i --save @rabbit-company/argon2id

2. Import library

import Argon2id from "@rabbit-company/argon2id";

3. Use library

/*

  Parameters:
  1. Message (String)
  2. Salt (String) <>
  3. Parallelism Factor (Int) <4> (Min = 1)
  4. Memory Cost (Int) <16> (Min = 2)
  5. Iterations (Int) <3> (Min = 1)
  6. Length (Int) <32> (Min = 4)

*/

// Generate hash from the provided message
// If you don't provide salt, it will be auto generated
Argon2id.hash("message").then(hash => {
  console.log("Hash: " + hash);
}).catch(err => {
  console.log("Error: " + err);
});

// Generate Encoded hash from the provided message
// Both hash and hashEncoded functions accept the same parameters
Argon2id.hashEncoded("message").then(hashEncoded => {
  console.log("Encoded Hash: " + hashEncoded);
}).catch(err => {
  console.log("Error: " + err);
});

// To get hash from hashEncoded function you can use function called hashDecode
Argon2id.hashDecode("$argon2id$v=19$m=65536,t=3,p=4$OVg1TXI3eTlzcnc2SjIxNw$LtPyv2bn74MJPui2JBPXWx5jXMd1uUv3515emrYSlhM");

// Generate hash from the provided message and salt
Argon2id.hash("message", "3yBtO1brz26g074n").then(hash => {
  console.log("Hash: " + hash);
}).catch(err => {
  console.log("Error: " + err);
});

// To generate random secure salt use randomSalt function
Argon2id.hashEncoded("message", Argon2id.randomSalt()).then(hashEncoded => {
  console.log("Encoded Hash: " + hashEncoded);
}).catch(err => {
  console.log("Error: " + err);
});

// Generate hash from the provided message, salt, iterations, memory cost, parallelism factor and hash length
Argon2id.hashEncoded("message", Argon2id.randomSalt(), 4, 16, 3, 32).then(hashEncoded => {
  console.log("Encoded Hash: " + hashEncoded);
}).catch(err => {
  console.log("Error: " + err);
});

// To validate the message you can use verify function.
// This function accept hashEncoded and message.
Argon2id.verify("$argon2id$v=19$m=65536,t=3,p=4$OVg1TXI3eTlzcnc2SjIxNw$LtPyv2bn74MJPui2JBPXWx5jXMd1uUv3515emrYSlhM", "vbFI6Dfihsw?QnxYOhYxzpxu&vYzTa").then(match => {
  if(match){
    console.log("Message is valid.");
  }else{
    console.log("Message is not valid.");
  }
}).catch(err => {
  console.log("Error: " + err);
});