5

I'm looking for solditiy-code to generate hashes of different hash-algorithms

  • MD5
  • SHA1
  • SHA512

and more. Is there any project which implemented hash-algorithms in solidity?

Is there someone out there who also needs this?

2 Answers 2

4

A pure Solidity version of SHA1 can be found in this repository. (See sha1.sol to jump to the code.)

From the README:

Pure-solidity implementation of the SHA1 hash function, heavily optimised using inline-assembly.

Gas consumption is approximately 56k per 512 bit block.

0

Solidity implements several hash function:

  • RIPEMD-160
  • SHA-256
  • Ethereum-SHA-3 (Keccak-256)

You can find additional information on the solidity website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.