Package Exports
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 (hash-wasm-rs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
hash-wasm-rs
A WebAssembly library for computing hashes, built with Rust.
Features
- Supports multiple hash algorithms: SHA-256, SHA-512, SHA3-256, SHA3-512, MD5, BLAKE3.
Installation
pnpm add hash-wasm-rsUsage
import initWasm, { HasherWrapper, HashType } from "hash-wasm-rs";
await initWasm();
// Compute hash from text input
const text = "Hello, world!";
const hasher = new HasherWrapper(HashType.MD5, text);
const result = await hasher.result();
console.log(result.hex);
// Compute hash from file data
const file = new File(["Hello, world!"], "hello.txt");
const hasher = new HasherWrapper(HashType.MD5, file);
const result = await hasher.result();
console.log(result.hex);Example usage
Example large file hash calculation
Development
# Build WebAssembly library
wasm-pack build --release --target web
# Build WebAssembly library with SIMD support
RUSTFLAGS="-C target-feature=+simd128" wasm-pack build --release --target web
# Serve the demo page
python3 -m http.server