In solidity there is the keccak256 function which hashes its arguments. I use the keccak256 to compute and use the result to check if some entries exist in my array.
I want to compute the same value in javascript and check if the entry exists on the blockchain, although the web3.sha gives different value than the keccak256.
How can I compute the same value for the same arguments?
In console I run this:
web3.sha3("test1");
and my contract:
function hashVal(bytes32 val) public returns(bytes32) {
return keccak256(val);
}