Skip to content
affaan-m avatar

Nodejs Keccak256

Prevents Ethereum hashing bugs by using Keccak-256 helpers instead of Node's NIST SHA3 sha3-256.

CCM score
77 of 100
skills.sh installs
10.8K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers Ethereum Keccak-256 hashing in JavaScript and TypeScript for function selectors, event topics, and EIP-712 type hashes
  • Includes ethers, viem, and web3.js examples for storage slots, packed hashing, and address derivation from public keys
  • Enforces a rule against crypto.createHash('sha3-256') in Ethereum contexts, since it silently produces different output
  • Provides grep commands to audit a codebase for direct sha3-256 usage and Keccak call sites

Install

$ npx -y skills add affaan-m/ecc --skill nodejs-keccak256 -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Node.js Keccak-256

Ethereum uses Keccak-256, not the NIST-standardized SHA3 variant exposed by Node's crypto.createHash('sha3-256').

When to Use

  • Computing Ethereum function selectors or event topics
  • Building EIP-712, signature, Merkle, or storage-slot helpers in JS/TS
  • Reviewing any code that hashes Ethereum data with Node crypto directly

How It Works

The two algorithms produce different outputs for the same input, and Node will not warn you.

import crypto from 'crypto';
import { keccak256, toUtf8Bytes } from 'ethers';

const data = 'hello';
const nistSha3 = crypto.createHash('sha3-256').update(data).digest('hex');
const keccak = keccak256(toUtf8Bytes(data)).slice(2);

console.log(nistSha3 === keccak); // false

Examples

ethers v6

import { keccak256, toUtf8Bytes, solidityPackedKeccak256, id } from 'ethers';

const hash = keccak256(new Uint8Array([0x01, 0x02]));
const hash2 = keccak256(toUtf8Bytes('hello'));
const topic = id('Transfer(address,address,uint256)');
const packed = solidityPackedKeccak256(
  ['address', 'uint256'],
  ['0x742d35Cc6634C0532925a3b8D4C9B569890FaC1c', 100n],
);

viem

Details

Repository
github.com/affaan-m/ecc
Categories
Web3 & Crypto, Security
First seen
Jul 14, 2026

Questions

What does the nodejs-keccak256 skill do?

It prevents Ethereum hashing bugs in JavaScript and TypeScript code. Node's sha3-256 is NIST SHA3, not Ethereum Keccak-256, so using it silently breaks selectors, signatures, storage slots, and address derivation.

When should an agent use the nodejs-keccak256 skill?

Use it when hashing for Ethereum in JavaScript or TypeScript, or when a selector, signature, storage slot, or derived address is wrong. It also covers reviewing code that hashes Ethereum data with Node crypto directly.

How do I install the nodejs-keccak256 skill?

Run npx -y skills add affaan-m/ecc --skill nodejs-keccak256 -y in your project. The skill then tells the agent to use Keccak-aware helpers from ethers, viem, or web3 instead of crypto.createHash('sha3-256').

Which other skills are in the Web3 and Crypto category?

The nodejs-keccak256 skill ranks in the top 50 of the Web3 and Crypto category on Claude Marketplaces. Other skills in that category include solana-dev, binance-agentic-wallet, okx-dex-market, gmgn-market, and gmgn-token.

More from affaan-m/ecc

All 257

Similar to Nodejs Keccak256

More Web3 & Crypto