nodejs-keccak256

Replace Node.js sha3-256 with Ethereum-correct Keccak-256 hashing in JavaScript and TypeScript.

Updated Sep 13, 2025
One-click install
npx skills add https://github.com/llmh333/employee_management_spring --skill nodejs-keccak256-llmh333
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nodejs-keccak256
Source: https://github.com/llmh333/employee_management_spring/tree/main/.gemini/skills/nodejs-keccak256
Command: npx skills add https://github.com/llmh333/employee_management_spring --skill nodejs-keccak256-llmh333

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents subtle Ethereum cryptography bugs caused by using Node.js SHA3-256 (NIST) where Ethereum requires Keccak-256, which can silently break selectors, signatures, storage slot derivation, and address calculations.

Core Features & Use Cases

  • Clarifies the SHA3 vs Keccak mismatch: Ensures you don’t rely on crypto.createHash('sha3-256') for Ethereum-standard hashing.
  • Supports Ethereum hashing workflows: Helps with function selectors, event topics, EIP-712 construction, Merkle helpers, and mapping/storage-slot derivation.
  • Provides audit and correction guidance: Shows how to detect problematic hashing usage in a JavaScript/TypeScript codebase and replace it with Keccak-aware helpers from common libraries.

Quick Start

Ask the assistant to review your codebase for uses of createHash('sha3-256') in Node.js and to rewrite the hashing logic to use Keccak-256 functions from ethers, viem, or web3.js.

Frequently Asked Questions about nodejs-keccak256

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

FAQPage Schema
Why does my Ethereum function selector mismatch when using Node.js sha3-256?

Your Ethereum function selector mismatch occurs because Node.js sha3-256 uses the NIST standard, whereas Ethereum requires Keccak-256. You must replace `crypto.createHash('sha3-256')` with Keccak-aware library functions to compute correct selectors.

How do I compute EIP-712 type hashes correctly in JavaScript and TypeScript?

To compute EIP-712 type hashes correctly in JavaScript and TypeScript, use Keccak-256 functions from libraries like ethers, viem, or web3.js instead of Node.js sha3-256 to ensure hashes match Ethereum expectations.

Can I use Node.js crypto createHash for Ethereum storage slot derivation?

No, you cannot use Node.js crypto createHash for Ethereum storage slot derivation. It computes NIST sha3-256, which produces incorrect values; you must use explicit Keccak-256 hashing helpers to match Ethereum standards.

What is the best way to audit a JavaScript codebase for Keccak-256 hashing bugs?

The best way to audit a JavaScript codebase for Keccak-256 hashing bugs is to scan for `createHash('sha3-256')` usage and replace it with Keccak-aware functions from ethers, viem, or web3.js.

Does Ethereum Keccak-256 hashing work the same as NIST sha3-256 in TypeScript?

No, Ethereum Keccak-256 hashing does not work the same as NIST sha3-256 in TypeScript. They use different padding, causing silent mismatches in event topics, signatures, and address derivation unless explicitly corrected.

How do I fix event topic hashing mismatches in web3.js?

To fix event topic hashing mismatches in web3.js, ensure your codebase relies on the library's built-in Keccak-256 functions and removes any Node.js NIST sha3-256 usage that silently breaks the expected Ethereum event topics.