Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

SHA-1 adapter for WebAssembly and JS implementations

NotificationsYou must be signed in to change notification settings

hazae41/sha1

Repository files navigation

SHA-1 adapter for WebAssembly and JS implementations

npm i @hazae41/sha1

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies

Getting started

WebAssembly

npm i @hazae41/sha1.wasm
import{Sha1}from"@hazae41/sha1"import{Sha1Wasm}from"@hazae41/sha1.wasm"awaitSha1Wasm.initBundled()Sha1.set(Sha1.fromWasm(Sha1Wasm))

Noble (JavaScript)

npm i @noble/hashes
import{Sha1}from"@hazae41/sha1"importSha1Noblefrom"@noble/hashes/sha1"Sha1.set(Sha1.fromNoble(Noble))

Usage

Direct

usinghashed:Copiable=Sha1.get().getOrThrow().hashOrThrow(newUint8Array([1,2,3,4,5]))consthashed2:Uint8Array=hashed.bytes.slice()

Incremental

usinghasher:Sha1.Hasher=Sha1.get().getOrThrow().Hasher.createOrThrow()hasher.updateOrThrow(newUint8Array([1,2,3,4,5]))hasher.updateOrThrow(newUint8Array([6,7,8,9,10]))usinghashed:Copiable=hasher.finalizeOrThrow()consthashed2:Uint8Array=hashed.bytes.slice()

[8]ページ先頭

©2009-2025 Movatter.jp