@chainsafe/as-sha256
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

as-sha256

ES Version Node Version

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

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i @chainsafe/as-sha256

    Weekly Downloads

    79,772

    Version

    0.4.2

    License

    Apache-2.0

    Unpacked Size

    198 kB

    Total Files

    28

    Last publish

    Collaborators

    • sadiq1971
    • ansermino
    • gregthegreek
    • priom
    • wemeetagain
    • mpetrunic