Skip to content

axetroy/wasm-hasher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

computed data hash by webAssembly

Support md5/sha1/sha224/sha256/sha512/sm3/ripemd/tiger/whirlpool/blake

Build Status

Built with 🦀🕸 and inspired by github.com/fuyoo/wasm-hasher

The difference with 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 use 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

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

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
@axetroy/wasm-hasher-md5 npm version
@axetroy/wasm-hasher-sha1 npm version
@axetroy/wasm-hasher-sha2 npm version
@axetroy/wasm-hasher-sha3 npm version
@axetroy/wasm-hasher-sm3 npm version
@axetroy/wasm-hasher-ripemd npm version
@axetroy/wasm-hasher-tiger npm version
@axetroy/wasm-hasher-whirlpool npm version
@axetroy/wasm-hasher-blake npm version

🛠️ Build from source

Make sure you have install rust^1.69 and wasm-pack

make

License

Anti-996

About

computed data hash by webAssembly support md5,sha1,sha2,sha3,sm3 and more

Resources

License

Stars

Watchers

Forks

Packages

No packages published