How to use the argon2.argon2i 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
// The minimum recommended size for the salt is 128 bits.
  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