hash-wasm-rs
Version:
A WebAssembly library for computing file hashes, built with Rust.
73 lines (53 loc) • 1.32 kB
Markdown
for computing hashes, built with Rust.
| Name
| ----------------------------------------------
| BLAKE3
| MD5
| SHA: SHA-224, SHA-256, SHA-384, SHA-512
| SHA-3: SHA3-224, SHA3-256, SHA3-384, SHA3-512
```bash
pnpm add hash-wasm-rs
```
[ ](./index.html)
```bash
pnpm add vite-plugin-wasm
```
```javascript
import { defineConfig } from "vite";
import wasm from "vite-plugin-wasm";
export default defineConfig(({ mode }) => ({
plugins: [wasm()],
}));
```
```javascript
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);
}
});
```
```bash
wasm-pack build --release
wasm-pack build --release --target web --out-dir pkg-web
RUSTFLAGS="-C target-feature=+simd128" wasm-pack build --release --target web
python3 -m http.server
```
[ ](./LICENSE)
A WebAssembly library