Solidity: Alias a new name to the SHA3 opcode

Created on 21 Jan 2016  路  10Comments  路  Source: ethereum/solidity

As a first step to https://github.com/ethereum/EIPs/issues/59

  • alias a new Solidity function to existing EVM SHA3 opcode (basically same as aliasing selfdestruct to SUICIDE opcode)
  • encourage use of new Solidity function by providing warnings in Solidity when sha3 is used
  • then possibly eventually compiler errors when sha3 is used in new Solidity code.

Below the surface, the same existing EVM SHA3 opcode is used by Solidity.

This issue is also a prerequisite if #362 (a Solidity function that does output SHA-3) was ever going to be implemented.

enhancement

Most helpful comment

Let's go for keccak256 as an alias and create warnings for usages of sha3. Those can turn into errors for a later release.

All 10 comments

suggestions for the new name, ksha3, keccak, others?

@ethers I would vote for keccak. However I do not think any alias or change should be made without consensus on the EIP. It would just create bigger confusion for the users of Solidity.

^agree with @axic

@chriseth what would it take for consensus? ;) I'm fine with keccak, so there's 3 "votes" for it. I'm not sure if we're going to get much ideas for better names...

I'm not sure if keccak is enough to disambiguate here. Of course, sha3 is probably worse, so we could go for it.

keccak256 would be completely unambiguous, if ambiguity is the issue.

Btw, in regard to @axic and @VoR0220 comments from Feb, I sincerely hope that "waiting for the EIP" is not the reason this has been held up here. SHA3 is flat out inaccurate, and it confuses the hell out of every programmer I introduce to solidity. There is _no_ disadvantage to simply adding an alias as soon as possible so that at least new code can be changed to appear way less confusing outside of the very narrow circle of Etherum people who understand how this happened historically. It will be way less work for everyone coming in if the first thing I can tell them is "Ethereum uses a hash function very similar to SHA3 called Keccak256" and just have them use that in their code from scratch. I highly support the EIP, but a Solidity alias is definitely the lowest hanging fruit to get the ball rolling. /rant

@emansipater I was actually reconsidering this in the past week and came to a similar conclusion. I don't see a change in EVM or the protocol likely, but at least the RPC documentation could be updated next to Solidity.

Adding the aliasing makes a lot of sense to me.

Let's go for keccak256 as an alias and create warnings for usages of sha3. Those can turn into errors for a later release.

Was this page helpful?
0 / 5 - 0 ratings