```\nfunction toEthSignedMessageHash(\n    bytes32 hash\n) internal pure returns (bytes32 message) {\n    // 32 is the length in bytes of hash,\n    // enforced by the type signature above\n    /// @solidity memory-safe-assembly\n    assembly {\n        mstore(0x00, "\x19Ethereum Signed Message:\n32")\n        mstore(0x1c, hash)\n        message := keccak256(0x00, 0x3c)\n    }\n}\n```\n