Is it possible to perform cryptographic operations inside a smart contract? I'm specifically thinking about simple hashing (SHA-1/256/3) and symmetric encryption (AES). Obviously, handling key material for encryption is an issue that has to be addressed. But is it possible, in general, to do these operations?
There's a crypto.h inside of the
contracts/eosiolib folder that has SHA/ripemd methods.
AES should be done off-chain though since the cleartext would be visible to anyone replaying the blockchain and viewing the action arguments.
Yes! It's very much possible! Look at the Dice contract example on the eosio github or in the repo folder eos/contracts/dice The function shown is a sha256 hashing method called
Link to the actual dice.cpp file containing it's use on github: The Eosio example dice.cpp file
Yes, it is possible. Please see here: https://github.com/EOSIO/eos/blob/master/contracts/eosiolib/crypto.h
Developers can also compile their favourite C/C++ crypto library to do things EOSIO natively doesn't support.
For everyone searching for the actual link to the cryptoapi, here it is!