How to use the argon2-browser.hash function in argon2-browser

To help you get started, we’ve selected a few argon2-browser 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 DefinitelyTyped / DefinitelyTyped / types / argon2-browser / argon2-browser-tests.ts View on Github external
(async () => {
  (await argon2.hash(mandatoryOptions)).encoded; // string
  (await argon2.hash(mandatoryOptions)).hash; // Uint8Array
  (await argon2.hash(mandatoryOptions)).hashHex; // string

  (await argon2.hash({ ...mandatoryOptions, distPath: 'path' })).encoded; // string
  (await argon2.hash({ ...mandatoryOptions, hashLen: 24 })).encoded; // string
  (await argon2.hash({ ...mandatoryOptions, mem: 1024 })).encoded; // string
  (await argon2.hash({ ...mandatoryOptions, parallelism: 1 })).encoded; // string
  (await argon2.hash({ ...mandatoryOptions, time: 1 })).encoded; // string
  (await argon2.hash({ ...mandatoryOptions, type: argon2.ArgonType.Argon2d })).encoded; // string
  (await argon2.hash({ ...mandatoryOptions, type: argon2.ArgonType.Argon2i })).encoded; // string

  await argon2.verify(verifyOptions); // undefined

  argon2.unloadRuntime(); // void
})();
github antelle / argon2-browser / examples / webpack / argon2-demo-webpack.js View on Github external
const argon2 = require('argon2-browser');

argon2
    .hash({
        pass: 'p@ssw0rd',
        salt: 'somesalt'
    })
    .then(hash => {
        document.querySelector('pre').innerText =
            `Encoded: ${hash.encoded}\n` +
            `Hex: ${hash.hashHex}\n`;

        argon2
            .verify({
                pass: 'p@ssw0rd',
                encoded: hash.encoded
            })
            .then(() => document.querySelector('pre').innerText += 'Verified OK')
            .catch(e => console.error('Error: ', e));
github antelle / argon2-browser / examples / node / argon2-demo-node.js View on Github external
const argon2 = require('argon2-browser');

argon2
    .hash({
        pass: 'p@ssw0rd',
        salt: 'somesalt'
    })
    .then(hash => {
        console.log(`Encoded: ${hash.encoded}`);
        console.log(`Hex: ${hash.hashHex}`);

        argon2
            .verify({
                pass: 'p@ssw0rd',
                encoded: hash.encoded
            })
            .then(() => console.log('Verified OK'))
            .catch(e => console.error('Error: ', e));
    })
github Authenticator-Extension / Authenticator / src / models / argon.ts View on Github external
static async hash(value: string) {
    const salt = window.crypto.getRandomValues(new Uint8Array(16));
    const hash = await argon2.hash({
      pass: value,
      salt,
      mem: 1024 * 16,
      type: argon2.ArgonType.Argon2id
    });

    return hash.encoded;
  }

argon2-browser

Argon2 library compiled for browser runtime

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages