Skip to content

RIPEMD-160 adapter for WebAssembly and JS implementations

Notifications You must be signed in to change notification settings

hazae41/ripemd160

Repository files navigation

Ripemd160

RIPEMD-160 adapter for WebAssembly and JS implementations

npm i @hazae41/ripemd160

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies

Getting started

WebAssembly

npm i @hazae41/ripemd.wasm
import { Ripemd160 } from "@hazae41/ripemd160"
import { RipemdWasm } from "@hazae41/ripemd.wasm"

await RipemdWasm.initBundled()

Ripemd160.set(Ripemd160.fromWasm(RipemdWasm))

Noble (JavaScript)

npm i @noble/hashes
import { Ripemd160 } from "@hazae41/ripemd160"
import Ripemd160Noble from "@noble/hashes/ripemd160"

Ripemd160.set(Ripemd160.fromNoble(Ripemd160Noble))

Usage

Direct

using hashed: Copiable = Ripemd160.get().getOrThrow().hashOrThrow(new Uint8Array([1,2,3,4,5]))
const hashed2: Uint8Array = hashed.bytes.slice()

Incremental

using hasher: Ripemd160.Hasher = Ripemd160.get().getOrThrow().Hasher.createOrThrow()
hasher.updateOrThrow(new Uint8Array([1,2,3,4,5]))
hasher.updateOrThrow(new Uint8Array([6,7,8,9,10]))

using hashed: Copiable = hasher.finalizeOrThrow()
const hashed2: Uint8Array = hashed.bytes.slice()

About

RIPEMD-160 adapter for WebAssembly and JS implementations

Resources

Stars

Watchers

Forks

Packages

No packages published