Is there a simple way to convert a bytes32, e.g. 0xca35b7d915458ef540ade6068dfe2f44e8fa733c
, to an address?
bytes32 data = "0xca35b7d915458ef540ade6068dfe2f44e8fa733c";
I tried casting it with address(data)
but that didn't work. I've also seen this solution here but that only works with bytes
and not bytes32
.
Here's the function I need in solidity:
function bytes32ToAddress(bytes32 input) public pure returns(address){
// convert input to address
return ...;
}