How to use the argon2.argon2d function in argon2

To help you get started, we’ve selected a few argon2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simonepri / phc-argon2 / index.js View on Github external
saltSize: 16
});

/**
 * Supported Argon2 variants.
 * Argon2 currently has three modes:
 * - d: Argon2d data-dependent.
 * - i: Argon2i data-independent.
 * - id: Argon2id a mix of the two.
 * See https://crypto.stackexchange.com/a/49969
 * @private
 * @type {Object}
 */
const variants = Object.freeze({
  i: argon2.argon2i,
  d: argon2.argon2d,
  id: argon2.argon2id
});

/**
 * Supported Argon2 versions.
 * @private
 * @type {number[]}
 */
const versions = [
  0x10, // 1.0 (16)
  0x13 // 1.3 (19)
];

/**
 * Computes the hash string of the given password in the PHC format using argon2
 * package.
github mythal / boluo / server / src / utils.ts View on Github external
export const passwordHash = (password: string): Promise => {
  return argon2.hash(password, { timeCost: 4, memoryCost: 512, parallelism: 8, type: argon2.argon2d });
};

argon2

An Argon2 library for Node

MIT
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis