nodejs-keccak256

Identify and correct Node sha3-256 usage to Keccak-256 in Ethereum JavaScript code.

Updated Jun 24, 2026
One-click install
npx skills add https://github.com/mostafa-ismail-2004/codex-plugin --skill nodejs-keccak256-mostafa-ismail-2004
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nodejs-keccak256
Source: https://github.com/mostafa-ismail-2004/codex-plugin/tree/main/skills/nodejs-keccak256
Command: npx skills add https://github.com/mostafa-ismail-2004/codex-plugin --skill nodejs-keccak256-mostafa-ismail-2004

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents a common but serious Ethereum hashing mistake in JavaScript and TypeScript: using Node's sha3-256 instead of Keccak-256, which produces different outputs and can silently break selectors, signatures, storage slots, and address derivation.

Core Features & Use Cases

  • Hashing Guidance: Shows when to use Keccak-aware helpers instead of Node crypto for Ethereum data.
  • Library Examples: Demonstrates correct usage with ethers, viem, and web3.js for selectors, topics, packed hashing, and public key conversion.
  • Audit Support: Helps inspect a codebase for risky sha3-256 usage and replace it with Ethereum-correct hashing.
  • Use Case: If a dApp computes a function selector or mapping slot in JavaScript, this Skill helps ensure the implementation matches Ethereum expectations.

Quick Start

Review your JavaScript or TypeScript code for any Ethereum hashing logic and replace Node sha3-256 with a Keccak-aware helper from ethers, viem, or web3.

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 sha3-256 in JavaScript?

Using Node sha3-256 instead of Keccak-256 causes Ethereum hashing mismatches because they produce different outputs, silently breaking function selectors, signatures, and storage slot calculations. You must use a Keccak-aware hashing library like ethers, viem, or web3.

How do I compute Keccak-256 hashes in TypeScript for EIP-712 typed data?

To compute Keccak-256 hashes for EIP-712 typed data in TypeScript, replace Node crypto with Keccak-aware helpers from libraries like ethers, viem, or web3 to ensure packed encoding produces Ethereum-compatible outputs.

Does Node.js crypto sha3-256 produce the same output as Ethereum Keccak-256?

No, Node.js crypto sha3-256 does not produce the same output as Ethereum Keccak-256. They follow different standards, meaning Node sha3-256 will silently break Ethereum function selectors, event topics, and address derivation.

What is the best way to calculate Ethereum storage slots in JavaScript?

The best way to calculate Ethereum storage slots in JavaScript is to use Keccak-aware hashing helpers from ethers, viem, or web3 instead of Node sha3-256 to ensure the packed encoding matches Ethereum expectations.

How do I derive an Ethereum address from a public key in JavaScript correctly?

To derive an Ethereum address from a public key correctly in JavaScript, use a Keccak-aware library like ethers, viem, or web3, because using Node sha3-256 will produce incorrect addresses due to hashing standard differences.

Can I use ethers, viem, and web3 to fix Ethereum hashing issues in TypeScript?

Yes, you can use ethers, viem, and web3 to fix Ethereum hashing issues in TypeScript. These Keccak-aware libraries provide the correct hashing functions needed to replace Node sha3-256 for selectors, topics, and packed encoding.