Socket
Socket
Sign inDemoInstall

argon2

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

argon2

An Argon2 library for Node


Version published
Maintainers
1
Created

What is argon2?

The argon2 npm package is a library for hashing passwords using the Argon2 algorithm, which is a modern, secure, and memory-hard hashing algorithm. It is designed to be resistant to GPU cracking attacks and is considered one of the most secure password hashing algorithms available.

What are argon2's main functionalities?

Hashing a password

This feature allows you to hash a password using the Argon2 algorithm. The hash function takes a plain text password and returns a hashed version of it.

const argon2 = require('argon2');
(async () => {
  try {
    const hash = await argon2.hash('password');
    console.log(hash);
  } catch (err) {
    console.error(err);
  }
})();

Verifying a password

This feature allows you to verify a password against a previously hashed password. The verify function takes a hash and a plain text password and returns a boolean indicating whether the password matches the hash.

const argon2 = require('argon2');
(async () => {
  try {
    const hash = await argon2.hash('password');
    const isMatch = await argon2.verify(hash, 'password');
    console.log(isMatch); // true
  } catch (err) {
    console.error(err);
  }
})();

Configuring hashing options

This feature allows you to configure various options for the hashing process, such as the type of Argon2 algorithm to use (argon2d, argon2i, or argon2id), memory cost, time cost, and parallelism.

const argon2 = require('argon2');
(async () => {
  try {
    const hash = await argon2.hash('password', {
      type: argon2.argon2id,
      memoryCost: 2 ** 16,
      timeCost: 5,
      parallelism: 1
    });
    console.log(hash);
  } catch (err) {
    console.error(err);
  }
})();

Other packages similar to argon2

Keywords

FAQs

Package last updated on 30 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc