[Ethereum] How to implement cryptographic algorithms in smart contracts

cryptographyecdsaserpentsolidity

I need to implement cryptographic algorithms such as AESCCM and elliptic curve algorithms (ECDSA, ECIES) within a smart contract. Is there any implementation of such algorithms in Solidity or Serpent?

Or is there is any way to integrate Python code (or other language) within Serpent for example (there many cryptographic libraries in Python)?

Or any other suggestions on how can I implement those algorithms?

Best Answer

This library is a good starting point: https://github.com/HarryR/solcrypto

As Richard points out symmetric key crypto and private key operation are rarely sensible in a smart contract as the smart contract has no privacy. However public key operations like checking signatures, proofs and hashes can be very useful and got more efficient with the addition of the elliptic curve precompiled contracts in Byzantium.

Related Topic