Install any skill in seconds. Free to start, no credit card required.
Get Started Free →JavaScriptとTypeScriptにおけるEthereumハッシュバグを防ぐ。NodeのSHA3-256はNIST SHA3であり、Ethereum Keccak-256ではなく、セレクター、署名、ストレージスロット、アドレス導出を静かに破壊する。
.claude/skills/affaan-m-nodejs-keccak256/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-09 | ✓→✗ | ▼ Worse | -4% | 0% |
| case-10 | ✓→✓ | = Same ✓ | -5% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 12% | 0% |
以太坊使用 Keccak-256,而非 Node 的 crypto.createHash('sha3-256') 所暴露的 NIST 标准化 SHA3 变体。
两种算法对相同输入会产生不同输出,且 Node 不会发出警告。
javascriptimport 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
typescriptimport { 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], );
typescriptimport { keccak256, toBytes } from 'viem'; const hash = keccak256(toBytes('hello'));
javascriptconst hash = web3.utils.keccak256('hello'); const packed = web3.utils.soliditySha3( { type: 'address', value: '0x742d35Cc6634C0532925a3b8D4C9B569890FaC1c' }, { type: 'uint256', value: '100' }, );
typescriptimport { id, keccak256, AbiCoder } from 'ethers'; const selector = id('transfer(address,uint256)').slice(0, 10); const typeHash = keccak256(toUtf8Bytes('Transfer(address from,address to,uint256 value)')); function getMappingSlot(key: string, mappingSlot: number): string { return keccak256( AbiCoder.defaultAbiCoder().encode(['address', 'uint256'], [key, mappingSlot]), ); }
typescriptimport { keccak256 } from 'ethers'; function pubkeyToAddress(pubkeyBytes: Uint8Array): string { const hash = keccak256(pubkeyBytes.slice(1)); return '0x' + hash.slice(-40); }
bashgrep -rn "createHash.*sha3" --include="*.ts" --include="*.js" --exclude-dir=node_modules . grep -rn "keccak256" --include="*.ts" --include="*.js" . | grep -v node_modules
在以太坊上下文中,切勿使用 crypto.createHash('sha3-256')。应使用来自 ethers、viem、web3 或其他明确 Keccak 实现的 Keccak 感知辅助函数。
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-10 | pass→pass | 12,749 | 8,192 | -36% | 1 | 1 | 0% | 2,755 | 2,611 | -5% | 0 | 0 | — |
case-01 | pass→pass | 9,760 | 7,137 | -27% | 1 | 1 | 0% | 2,100 | 2,345 | +12% | 0 | 0 | — |
case-02 | pass→pass | 6,734 | 5,329 | -21% | 1 | 1 | 0% | 1,525 | 2,126 | +39% | 0 | 0 | — |
case-03 | pass→pass | 4,627 | 3,731 | -19% | 1 | 1 | 0% | 943 | 1,556 | +65% | 0 | 0 | — |
case-04 | pass→pass | 4,357 | 3,782 | -13% | 1 | 1 | 0% | 1,018 | 1,807 | +78% | 0 | 0 | — |
case-05 | fail→pass | 5,601 | 3,892 | -31% | 1 | 1 | 0% | 1,186 | 1,755 | +48% | 0 | 0 | — |
case-06 | pass→pass | 5,052 | 3,185 | -37% | 1 | 1 | 0% | 963 | 1,543 | +60% | 0 | 0 | — |
case-07 | pass→pass | 8,579 | 4,493 | -48% | 1 | 1 | 0% | 1,863 | 1,945 | +4% | 0 | 0 | — |
case-08 | pass→pass | 4,098 | 4,024 | -2% | 1 | 1 | 0% | 694 | 1,721 | +148% | 0 | 0 | — |
case-09 | pass→fail | 9,700 | 5,576 | -43% | 1 | 1 | 0% | 2,201 | 2,114 | -4% | 0 | 0 | — |
case-11 | pass→pass | 4,417 | 4,490 | +2% | 1 | 1 | 0% | 939 | 1,930 | +106% | 0 | 0 | — |
case-12 | pass→pass | 3,952 | 3,054 | -23% | 1 | 1 | 0% | 798 | 1,566 | +96% | 0 | 0 | — |
case-13 | fail→pass | 19,986 | 5,330 | -73% | 1 | 1 | 0% | 1,705 | 2,012 | +18% | 0 | 0 | — |
case-14 | pass→pass | 5,284 | 3,330 | -37% | 1 | 1 | 0% | 1,165 | 1,577 | +35% | 0 | 0 | — |
case-15 | pass→pass | 4,819 | 4,262 | -12% | 1 | 1 | 0% | 1,103 | 1,833 | +66% | 0 | 0 | — |
case-16 | pass→pass | 6,028 | 6,119 | +2% | 1 | 1 | 0% | 1,238 | 2,004 | +62% | 0 | 0 | — |
case-17 | pass→pass | 10,929 | 13,844 | +27% | 1 | 1 | 0% | 2,266 | 3,387 | +49% | 0 | 0 | — |
case-18 | pass→pass | 6,774 | 5,809 | -14% | 1 | 1 | 0% | 1,415 | 1,984 | +40% | 0 | 0 | — |
case-19 | pass→pass | 5,256 | 3,989 | -24% | 1 | 1 | 0% | 1,145 | 1,718 | +50% | 0 | 0 | — |
case-20 | pass→pass | 12,694 | 7,998 | -37% | 1 | 1 | 0% | 2,721 | 2,508 | -8% | 0 | 0 | — |
case-21 | pass→pass | 11,622 | 8,379 | -28% | 1 | 1 | 0% | 2,435 | 2,738 | +12% | 0 | 0 | — |
case-22 | pass→pass | 7,011 | 6,338 | -10% | 1 | 1 | 0% | 1,420 | 2,152 | +52% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of 0 percentage points is the difference between those two pass rates over the 21 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.