JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q38609F
  • License MIT

A WebAssembly library for computing file hashes, built with Rust.

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.

    Supported algorithms

    | Name
    | ----------------------------------------------
    | BLAKE3
    | MD5
    | SHA-2: SHA-224, SHA-256
    | SHA-3: SHA3-256, SHA3-512 | SHA-512

    Installation

    pnpm add hash-wasm-rs

    HTML Example usage

    Example large file hash calculation

    Vite Example usage

    pnpm add vite-plugin-wasm

    vite.config.ts

    import { defineConfig } from "vite";
    import wasm from "vite-plugin-wasm";
    
    export default defineConfig(({ mode }) => ({
      plugins: [wasm()],
    }));

    app.vue

    onMounted(async () => {
      try {
        const $hashWasmRs = await import("hash-wasm-rs");
        const result = await $hashWasmRs.md5("Hello, world!");
        console.log(result.hex);
        result.free();
      } catch (error) {
        console.error("WASM error:", error);
      }
    });

    Development

    # Build package WebAssembly library
    wasm-pack build --release
    # Build HTML WebAssembly library
    wasm-pack build --release --target web --out-dir pkg-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

    LICENSE

    MIT