Skip to content

Instantly share code, notes, and snippets.

@Souptacular
Last active August 22, 2018 16:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Souptacular/f50128d63b5188490fa2 to your computer and use it in GitHub Desktop.
Save Souptacular/f50128d63b5188490fa2 to your computer and use it in GitHub Desktop.
Testing SHA3 with Solidity
contract SHA3Test
{
function getSHA3Hash(bytes input) returns (bytes32 hashedOutput)
{
hashedOutput = sha3(input);
}
}
// Ethereum uses KECCAK-256. It should be noted that it does not follow
// the FIPS-202 based standard of Keccak, which was finalized in August 2015.
// Hashing the string "testing":
// Ethereum SHA3 function in Solidity = 5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02
// Keccak-256 (Original Padding) = 5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02
// SHA3-256 (NIST Standard) = 7f5979fb78f082e8b1c676635db8795c4ac6faba03525fb708cb5fd68fd40c5e
// More info:
// https://github.com/ethereum/EIPs/issues/59
// http://ethereum.stackexchange.com/questions/550/which-cryptographic-hash-function-does-ethereum-use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment