What is the difference between a chrysalis and a cocoon?

What is the difference between a chrysalis and a cocoon?

Butterflies hatch from a chrysalis, a life stage made of a hardened protein. A cocoon is spun from silk and surrounds the pupa of many moths.