[Ethereum] does keccak256 and sha3 reproduce the same hash

keccaksha3

I have this solidity method:

function hashData(bytes32 data) public constant returns (bytes32) {
    var hash = keccak256(data, msg.sender);
    return hash;
  }

for a data = "0x707974686f6e62" and address = "0x4c5f885b9854ce17e5620098e53f3032be002fed"

I dont get the same result using web3.sha3(data,address)

Best Answer

In Solidity, sha3 and keccak256 are aliases, so their output will be identical.

web3.sha3 is a different function in a different programming language (I assume JavaScript). You would probably find web3.utils.soliditySha3 helpful because as it reproduces the packing that Solidity does.

ethereumjs-abi has a similar function in case you're not using web3.js 1.0.