Human hair can last for years, sometimes even two, before degrading along with the softer tissues. Hair is formed of keratin, same like fingernails, and is far more resilient than skin and flesh.
The environment in which decomposition takes place has a significant impact. Despite the fact that most microorganisms, rodents, and insects do not eat hair or fingernails, they can speed up the process. The entire process takes far longer in a sealed grave, possibly on the order of years. If the corpse is exposed to the earth directly, or if it is left unburied and exposed to the wind, decomposition happens significantly more quickly.
Keratin is resistant to the breakdown enzymes. Proteolysis is the name for the process of rapidly breaking down squishy tissue. Moisture and invasive plant growth are more significant in the destruction of keratin, albeit the decomposition process finally takes its toll on the materials involved.
Hair and fingernails may last significantly longer than usual in some extreme circumstances where a corpse has been maintained by artificial techniques. This phase can last decades or even centuries, but it necessitates a sterile environment and meticulous care of the tomb or sepulchre in issue.