```\nfunction tryRecover(\n       bytes32 hash,\n       uint8 v,\n       bytes32 r,\n       bytes32 s\n   ) internal pure returns (address, RecoverError) {\n       // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n       // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n       // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n       // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n       //\n       // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n       // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n       // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n       // these malleable signatures as well.\n       if (\n           uint256(s) >\n           0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0\n       ) {\n           return (address(0), RecoverError.InvalidSignatureS);\n       }\n\n       // If the signature is valid (and not malleable), return the signer address\n       address signer = ecrecover(hash, v, r, s);\n       if (signer == address(0)) {\n           return (address(0), RecoverError.InvalidSignature);\n       }\n\n       return (signer, RecoverError.NoError);\n   }\n\n\n```\n