Package Exports
- @chainsafe/as-sha256
- @chainsafe/as-sha256/lib/hashObject
- @chainsafe/as-sha256/lib/hashObject.js
- @chainsafe/as-sha256/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@chainsafe/as-sha256) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
as-sha256
AssemblyScript implementation of SHA256.
Usage
yarn add @chainsafe/as-sha256
import {digest, digest64, SHA256} from "@chainsafe/as-sha256";
let hash: Uint8Array;
// create a new sha256 context
const sha256 = new SHA256();
// with init(), update(data), and final()
hash = sha256.init().update(Buffer.from("Hello world")).final();
// or use a one-pass interface
hash = digest(Buffer.from("Hello world"));
// or use a faster one-pass interface for hashing (only) 64 bytes
hash = digest64(Buffer.from("abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh"));
License
Apache 2.0