function compare(string memory input, uint _y) public returns (uint){ 
  bytes32 hashedinput = keccak256(input);
Error: Invalid type for argument in function call. Invalid implicit conversion from string memory to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding.
  bytes32 hashedinput = keccak256(input);

keccak256 takes bytes as input, use:

bytes32 hashedinput = keccak256(bytes(input));

hope it helps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.