It is narrated from Sayyiduna Ka'b bin 'Ujrah (may Allah be pleased with him) that the Prophet (ﷺ) came to me at Hudaybiyyah, and my hair was very long. He said: "It seems that lice have caused you a lot of trouble?" He says, I replied, "Yes, it is so." So the Prophet (ﷺ) said: "Shave your head and either slaughter a goat as a ransom, or fast for three days, or give three sa' of dates in charity to six needy people."
Hadith Referenceالسنن المأثورة / باب ما جاء في فدية الأذى / 448
Hadith Takhrijسنن ابی داؤد، المناسک، باب فی الفدیہ، رقم: 1856 وقال الالبانی: صحیح