Last active
August 22, 2018 16:46
-
-
Save Souptacular/f50128d63b5188490fa2 to your computer and use it in GitHub Desktop.
Testing SHA3 with Solidity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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