/sha256

SHA256 implementation extracted from Bitcoin Core and compiled to WebAssembly

Primary LanguageC++

SHA256 WASM

SHA256 implementation extracted from Bitcoin Core and compiled to WebAssembly.

Usage

import {sha256} from 'https://bitvm.github.io/sha256/sha256.js'

const preimage = new Uint8Array([97, 98, 99])    // Our preimage is "abc"
const digest = sha256(preimage)

console.log(digest)

Development

The following command compiles the sources to wasm:

clang src/sha256.cpp -O2 --no-standard-libraries --target=wasm32 -Wl,--no-entry -o sha256.wasm