Sayyiduna Ka'b bin Ujrah (may Allah be pleased with him) said: This verse was revealed concerning me. We were with the Prophet (peace and blessings be upon him) at al-Hudaybiyah in the state of ihram, and the polytheists were present before us. I had thick hair, and lice began falling onto my face. The Messenger of Allah (peace and blessings be upon him) passed by and said: "Are your lice troubling you?" I said: Yes, O Messenger of Allah. He (peace and blessings be upon him) said: "Then shave your head." Then this verse was revealed: "a ransom of fasting or charity or a sacrifice" [Surah al-Baqarah: 196]. He said: The fasting is three days, the charity is to six poor people, and the sacrifice is one goat.
Hadith Referenceالمعجم الكبير للطبراني / باب الكاف / 16269