pure keccak library
node / v12.5.0^
keccak224
keccak256
keccak384
keccak512
- npm install
npm install @cafeca/keccak
- create Keccak with algorithm name
const Keccak = require('@cafeca/keccak');
const keccak256 = new Keccak('keccak256');
- use update function with your text and digest function with encoding type you want to get hash output value
const hashResult = keccak256.update('Your test text').digest('hex');
- test the result - if your run the code from step 1 and step 2 without any modification, you will get the result down below
console.log(hashResult);
// hashResult = d215f22cf53667dcd80f18a730123452db9454a4a2f3db447cba9ddd8c3a34c9
- Get digest is already called error
// You need to call your update before digest
const hashResult = new Keccak('keccak256').update('Your test text').digest('hex');
prepare:
git clone https://github.com/CAFECA-IO/js-Keccak-Laria
cd js-Keccak-Laria
npm install
build:
npm run build
run:
npm run start
test
npm run test
test output:
src/lib/ : keccak f function and keccakState class
src/tests/ : test files
index.ts : main keccak class
jest.config.js : jest related config
package.json : script and installation related settings
tsconfig.json : use for typescript config