I try to use sha3
/keccak
functions inside a Solidity contract, but I get a weird error:
Untitled:5:13: Error: Undeclared identifier.
bytes32 d=keccak256(0x616263);
The contract :
pragma solidity ^0.4.0;
contract C {
bytes32 d=keccak256(0x616263);
bytes32 a=sha3(uint256(1));
}
Best Answer
the
keccak256()
is an alias for thesha3
function to avoid any confusion with the sha-3 standard (The opcode is still called SHA3.) this alias was adopted this month so the old compiler don't recognize it. so usesha3
instead.The available hashing functions are
sha3
,sha256
,ripemd160
: