# @axetroy/wasm-hasher

> computed data hash by webAssembly support md5,sha1,sha2,sha3,sm3,ripemd

Latest version **0.1.6** (published 2025-02-18) · Anti-996 license · 0 weekly downloads

## Install

```sh
npm install @axetroy/wasm-hasher
pnpm add @axetroy/wasm-hasher
yarn add @axetroy/wasm-hasher
bun add @axetroy/wasm-hasher
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2025-02-18 |
| First published | 2023-05-13 |
| Weekly downloads | 0 |
| License | Anti-996 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 262.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | axetroy |
| Keywords | md5, sha, sha1, sha2, sha3, sha256, sha512, ripemd, tiger, wasm, webassembly |

## Links

- npm: https://www.npmjs.com/package/@axetroy/wasm-hasher
- Repository: https://github.com/axetroy/wasm-hasher
- Homepage: https://github.com/axetroy/wasm-hasher#readme
- Issues: https://github.com/axetroy/wasm-hasher/issues
- npm.io page: https://npm.io/package/@axetroy/wasm-hasher

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.1.6 (latest) — 2025-02-18
- 0.1.5 — 2025-02-11
- 0.1.4 — 2025-02-11
- 0.1.3 — 2023-05-14
- 0.1.2 — 2023-05-13
- 0.1.1 — 2023-05-13
- 0.1.0 — 2023-05-13

## README

<div align="center">

  <h1><code>computed data hash by webAssembly</code></h1>

<strong>Support `md5`/`sha1`/`sha224`/`sha256`/`sha512`/`sm3`/`ripemd`/`tiger`/`whirlpool`/`blake`</strong>

  <p>
    <a href="https://github.com/axetroy/wasm-hasher/actions/workflows/rust.yml"><img src="https://github.com/axetroy/wasm-hasher/actions/workflows/rust.yml/badge.svg" alt="Build Status" /></a>
  </p>

<sub>Built with 🦀🕸 and inspired by [github.com/fuyoo/wasm-hasher](https://github.com/fuyoo/wasm-hasher)

</div>

The difference with [github.com/fuyoo/wasm-hasher](https://github.com/fuyoo/wasm-hasher)

1. Hash process can be interrupted with `AbortSignal`
2. The exposed function can specify the chunks size for each read. Larger chunks consume more CPU.
3. `onProgress` callback is optional. Set to `null` to improve performance if you don't need it.
4. separate packages, smaller wasm files

## Usage

```js
import * as hasher from "@axetroy/wasm-hasher";

const controller = new AbortController();
const file = new Blob([], { type: "application/text" });

const md5 = await hasher.md5(
  controller.signal,
  file,
  1024 * 1024 * 10,
  (progress) => {
    console.log("hash progress");
  }
);

console.log(md5);
```

## 🚴 Installation

```bash
npm install @axetroy/wasm-hasher
npm install @axetroy/wasm-hasher-md5
npm install @axetroy/wasm-hasher-sha1
npm install @axetroy/wasm-hasher-sha2
npm install @axetroy/wasm-hasher-sha3
npm install @axetroy/wasm-hasher-sm3
npm install @axetroy/wasm-hasher-ripemd
npm install @axetroy/wasm-hasher-tiger
npm install @axetroy/wasm-hasher-whirlpool
npm install @axetroy/wasm-hasher-blake
```

### Packages

| Package                        | Version                                                                                                                                    |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| @axetroy/wasm-hasher           | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher)                     |
| @axetroy/wasm-hasher-md5       | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-md5.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-md5)             |
| @axetroy/wasm-hasher-sha1      | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-sha1.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-sha1)           |
| @axetroy/wasm-hasher-sha2      | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-sha2.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-sha2)           |
| @axetroy/wasm-hasher-sha3      | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-sha3.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-sha3)           |
| @axetroy/wasm-hasher-sm3       | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-sm3.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-sm3)             |
| @axetroy/wasm-hasher-ripemd    | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-ripemd.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-ripemd)       |
| @axetroy/wasm-hasher-tiger     | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-tiger.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-tiger)         |
| @axetroy/wasm-hasher-whirlpool | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-whirlpool.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-whirlpool) |
| @axetroy/wasm-hasher-blake     | [![npm version](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-blake.svg)](https://badge.fury.io/js/@axetroy%2Fwasm-hasher-blake)         |

### 🛠️ Build from source

Make sure you have install [rust^1.69](https://www.rust-lang.org/) and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)

```bash
make
```

## License

[Anti-996](License)

---
_Source: https://npm.io/package/@axetroy/wasm-hasher · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
