Packages

Ethereum library for Gleam - JSON-RPC client, transaction signing, ABI encoding, and wallet management on the BEAM

Current section

Files

Jump to
gleeth src gleeth crypto keccak_gleam_ffi.mjs
Raw

src/gleeth/crypto/keccak_gleam_ffi.mjs

import { keccak_256 } from "@noble/hashes/sha3";
export function hash(message) {
// Convert BitArray to Uint8Array
const bytes = new Uint8Array(message);
// Compute keccak256 hash
const hash = keccak_256(bytes);
// Return as BitArray (Uint8Array is compatible)
return hash;
}