https://github.com/hazae41/keccak256
Keccak-256 adapter for WebAssembly and JS implementations
https://github.com/hazae41/keccak256
Last synced: 9 days ago
JSON representation
Keccak-256 adapter for WebAssembly and JS implementations
- Host: GitHub
- URL: https://github.com/hazae41/keccak256
- Owner: hazae41
- Created: 2023-09-04T15:10:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-31T16:23:05.000Z (8 months ago)
- Last Synced: 2025-03-24T06:19:30.205Z (about 1 month ago)
- Language: TypeScript
- Size: 165 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Keccak256
Keccak-256 adapter for WebAssembly and JS implementations
```bash
npm i @hazae41/keccak256
```[**Node Package 📦**](https://www.npmjs.com/package/@hazae41/keccak256)
## Features
### Current features
- 100% TypeScript and ESM
- No external dependencies## Getting started
### WebAssembly
```bash
npm i @hazae41/sha3.wasm
``````typescript
import { Keccak256 } from "@hazae41/keccak256"
import { Sha3Wasm } from "@hazae41/sha3.wasm"await Sha3Wasm.initBundled()
Keccak256.set(Keccak256.fromWasm(Sha3Wasm))
```### Noble (JavaScript)
```bash
npm i @noble/hashes
``````typescript
import { Keccak256 } from "@hazae41/keccak256"
import Sha3Noble from "@noble/hashes/sha3"Keccak256.set(Keccak256.fromNoble(Sha3Noble))
```## Usage
### Direct
```tsx
using hashed: Copiable = Keccak256.get().getOrThrow().hashOrThrow(new Uint8Array([1,2,3,4,5]))
const hashed2: Uint8Array = hashed.bytes.slice()
```### Incremental
```tsx
using hasher: Keccak256.Hasher = Keccak256.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()
```