This package contains a async sha256 function using the native crypto API. Calling this function with an 'await' requires the code to be within a async block, see the below examples.
This requires a modern browser that supports native crypto.
npm install --save async-sha256import sha256 from 'async-sha256';
sha256('matt').then(function(hash) {
console.log(hash);//eslint-disable-line
});import sha256 from 'async-sha256';
async function doSomething() {
const hash = await sha256('matt');
console.log(hash);//eslint-disable-line
}
doSomething();- Pushed: updated read me to include instructions noting that this currently only works in modern browsers and not node.
- Pushed: modified exports to work correctly.
- Pushed: changed code examples.
- Pushed: relocated file, fixed bug, this can be 1.0.
- Pushed: first version