Skip to content

Instantly share code, notes, and snippets.

@Souptacular
Last active August 22, 2018 16:46

Revisions

  1. Souptacular revised this gist Jan 24, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion SHA3Test.sol
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,8 @@ contract SHA3Test
    // Hashing the string "testing":
    // Ethereum SHA3 function in Solidity = 5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02
    // Keccak-256 (Original Padding) = 5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02
    // SHA3-256 (NIST Standard) = 7f5979fb78f082e8b1c676635db8795c4ac6faba03525fb708cb5fd68fd40c5e
    // 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
  2. Souptacular revised this gist Jan 24, 2016. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion SHA3Test.sol
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,12 @@ contract SHA3Test
    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
  3. Souptacular created this gist Jan 24, 2016.
    8 changes: 8 additions & 0 deletions SHA3Test.sol
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    contract SHA3Test
    {
    function getSHA3Hash(bytes input) returns (bytes32 hashedOutput)
    {
    hashedOutput = sha3(input);
    }

    }