RIPEMD-160 adapter for WebAssembly and JS implementations
npm i @hazae41/ripemd160
- 100% TypeScript and ESM
- No external dependencies
npm i @hazae41/ripemd.wasm
import { Ripemd160 } from "@hazae41/ripemd160"
import { RipemdWasm } from "@hazae41/ripemd.wasm"
await RipemdWasm.initBundled()
Ripemd160.set(Ripemd160.fromWasm(RipemdWasm))
npm i @noble/hashes
import { Ripemd160 } from "@hazae41/ripemd160"
import Ripemd160Noble from "@noble/hashes/ripemd160"
Ripemd160.set(Ripemd160.fromNoble(Ripemd160Noble))
using hashed: Copiable = Ripemd160.get().getOrThrow().hashOrThrow(new Uint8Array([1,2,3,4,5]))
const hashed2: Uint8Array = hashed.bytes.slice()
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()