1.0.8 • Published 6 months ago

@hazae41/keccak256 v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Keccak256

Keccak-256 adapter for WebAssembly and JS implementations

npm i @hazae41/keccak256

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies

Getting started

Morax (WebAssembly)

npm i @hazae41/morax
import { Keccak256 } from "@hazae41/keccak256"

Keccak256.set(await Keccak256.fromMorax())

Noble (JavaScript)

npm i @noble/hashes
import { Keccak256 } from "@hazae41/keccak256"

Keccak256.set(Keccak256.fromNoble())

Usage

Direct

const hashed: Uint8Array = Keccak256.get().tryHash(new Uint8Array([1,2,3,4,5])).unwrap().copyAndDispose()

Incremental

const hasher = Keccak256.get().Hasher.tryNew().unwrap()
hasher.tryUpdate(new Uint8Array([1,2,3,4,5])).unwrap()
const hashed: Uint8Array = hasher.tryFinalize().unwrap().copyAndDispose()