I'm trying to make a hash of a number (in python) then have a solidity contract recreate the hash, then do something useful with the number.
(The motivation for this is that I ultimately want to sign the data and pass in the signature, then check it using ecrecover to validate the data, which is all working fine apart from the hashing part.)https://github.com/edmundedgar/show-confusion-about-solidity-types-and-sha3/blob/master/test.py
It's working fine for me if I hash a string, and pass the string into the contract. But then I'm stuck with a string in my contract, and I don't know how to change that into an int or do anything useful with it.https://github.com/edmundedgar/show-confusion-about-solidity-types-and-sha3/blob/master/hash_checker_string.sol
If I pass the contract bytes32 or int256 and call sha3() on that it produces some kind of hash, but I can't work out exactly what it's hashing, or how I would create the same hash myself in Python.
Can anyone tell me how to do any of:
a) Recreate the hash I'm getting in the contract outside the contract
b) Pass in the data to the contract in such a way that it creates the hash I'm making outside the contract
c) Change the string that I'm successfully hashing right now into bytes32 or int256 inside the contract?