Treatment with NaHS significantly decreased the cognitive impairment of rats after SAH and simultaneously reduced the expression of TNF-α, TLR4, and NF-κB p65 and alleviated the nuclear translocation of NF-κB p65 (p < 0.05). The gene discussed is TNF; the disease is Cognitive impairment.