Sayyiduna Ka'b bin Ujrah (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) saw Ka'b bin Ujrah (may Allah be pleased with him) while lice were falling from his head onto his face. He (peace and blessings be upon him) asked: "Are they troubling you?" Ka'b (may Allah be pleased with him) said: "Yes." So he (peace and blessings be upon him) ordered him to shave his head. The narrator said: They were at al-Hudaybiyah; it had not been made clear to them that they would exit ihram there, and they were hoping to enter Makkah. Then Allah Almighty revealed the ransom (fidyah), and the Messenger of Allah (peace and blessings be upon him) ordered him to give one faraq (sixteen ratls, or three sa's) of food to six poor people, or to fast for three days, or to sacrifice a goat.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 10074