I was using strings before I read that using bytes is gas cheaper. Now I changed my strings to bytes32 but I don't know how to compare them. I need to check if two bytes32 are equal in the require statement. How can I do it? Using normal == gives revert and surrouding it with keccak256 says it's invalid implicit conversion from bytes32 to bytes requested.
Solidity – How to Compare Two bytes32 Values in Solidity
bytesbytes32keccaksolidity
Best Answer
A comparison between two bytes32 IS possible in solidity. Consider this simple contract:
This contract will compile and it will return the correct answer (true). Could you please post your code along with the question? The issue is somewhere else, not in the comparison itself.