nodejs-keccak256

Prevents Ethereum hashing bugs caused by confusing Node's NIST SHA3-256 with Keccak-256.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill nodejs-keccak256-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nodejs-keccak256
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/nodejs-keccak256
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill nodejs-keccak256-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Node.js's built-in crypto.createHash('sha3-256') implements the NIST-standardized SHA3 variant, not the Keccak-256 algorithm Ethereum actually uses. The two produce different outputs for the same input with no warning, silently breaking function selectors, event topics, EIP-712 signatures, storage slots, and address derivation in JavaScript and TypeScript code. ## Core Features & Use Cases - Bug Detection Guidance: Explains why Node's sha3-256 differs from Ethereum Keccak-256 and demonstrates the mismatch with a runnable comparison snippet. - Correct Implementation Patterns: Provides copy-ready Keccak-256 examples for ethers v6, viem, and web3.js, covering selectors, event topics, packed hashing, mapping storage slots, and public-key-to-address derivation. - Codebase Auditing: Supplies grep commands to locate every createHash('sha3') call and existing keccak256 usage in a JS/TS repository. - Use Case: While reviewing a TypeScript service that computes EIP-712 type hashes with Node crypto, use this Skill to identify the incorrect hashing calls and replace them with ethers keccak256 helpers. ## Quick Start Ask the AI to audit this repository for Ethereum hashing code that uses Node's crypto sha3-256 and rewrite it with ethers keccak256.

Frequently Asked Questions about nodejs-keccak256

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compute Keccak-256 in Node.js for Ethereum?▼

Use the keccak256 function from ethers, viem, or web3.js instead of Node's built-in crypto module. For example, ethers v6 exposes keccak256(toUtf8Bytes(data)) for strings and solidityPackedKeccak256 for ABI-packed values.

Is sha3-256 the same as Keccak-256 in Ethereum?▼

No, Node's crypto.createHash('sha3-256') implements the NIST-standardized SHA3 variant, which differs from Ethereum's original Keccak-256. They produce different outputs for identical inputs, silently breaking selectors, signatures, and address derivation.

ethers vs viem vs web3.js for Keccak hashing?▼

All three libraries provide correct Keccak-256 implementations. Ethers offers keccak256 and solidityPackedKeccak256, viem exposes keccak256 with toBytes, and web3.js provides web3.utils.keccak256 and soliditySha3 for packed encoding.

How do I find sha3-256 misuse in my codebase?▼

Run grep -rn "createHash.*sha3" across your .ts and .js files excluding node_modules to locate unsafe Node crypto calls. Also grep for keccak256 to review existing Ethereum hashing usage and confirm it uses a Keccak-aware library.

Why is my Ethereum function selector or address wrong in JavaScript?▼

A common cause is hashing with Node's sha3-256 instead of Keccak-256, which yields different digests. Compute selectors with ethers id('transfer(address,uint256)').slice(0, 10) and derive addresses by Keccak-hashing the public key bytes.