I want to generate hash of string received through function argument. Sha256 require bytes in argument. How can I convert and then save hash in _hash variable.
struct ORGANIZATION{
bytes32 hash;
uint org_number;
}
function add_organization(string memory _stringvalue) public{
bytes32 _hash;
_hash=sha256(_stringvalue);
organization[organization_counter].hash=_hash;
organization[organization_counter].org_number=organization_counter;
organization_counter++;
}
bytes32 _hash = keccak256(_stringvalue);
. – goodvibration Jan 4 at 13:03