How to use the js-sha3.keccak512 function in js-sha3

To help you get started, we’ve selected a few js-sha3 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 kehitysto / coaching-chatbot / test / ft / autogenerated-tests.js View on Github external
it('should match with the given hash sum', () => {
        return expect(keccak512(scenarios[i].content.join()),
            'Run \'npm run visualize\' and ' +
            'check \'' + checkData[i].title + '\' in ' +
            'doc/flow/discussions.md. If it looks fine, copy ' +
            'the hash from automatically generated tests ' +
            'in the same document.')
          .to.equal(checkData[i].hash);
      });
    });
github kehitysto / coaching-chatbot / scripts / visualize.js View on Github external
.then((scenarios) => {
    let i = 0;
    for (let scenario of scenarios) {
      let hash = keccak512(scenario.content.join());
      ['  { title: \'' + scenario.title.split('# ')[1] + '\',',
       '    hash: \'' + hash + '\' },'].map(l => descriptions.push(l));
      i += 1;
    }
    return scenarios;
  })
  .then((scenarios) => {
github kehitysto / coaching-chatbot / scripts / visualize.js View on Github external
promise = promise.then((lines) => {
  const target = path.resolve(__dirname, '..', 'doc', 'flow', 'discussions.md');
  let hash = keccak512(lines.join());
  fs.writeFileSync(target, lines.join('\n') + '\n' + 
  ['# Automatic validation',
   'Copy this to test/ft to automate this test:',
   '```javascript',
   'import * as discussions from \'../../doc/flow/discussions.json\';',
   'import * as path from \'path\';',
   'import * as states from \'../../doc/flow/states.json\';',
   'import * as DiscussionGenerator from \'../generate-discussions\';',
   'import { keccak512 } from \'js-sha3\';',
   '',
   'let scenarios;',
   '',
   'let checkData = [',
   ...descriptions,
   '];',
   '',