Place the candy canes in a sealable freezer bag. (A freezer bag is best because it's thicker.) Wrap a kitchen towel around the bag of candy canes and place on a clean work surface. Use the bottom of a heavy pot or skillet to crush the candy canes into fine crumbs. Set aside.
Brush an 8-inch square baking dish with butter. Melt 1/2 cup of butter with the salt in a heavy saucepan over low heat. Whisk in the confectioners’ sugar and milk until very smooth. Add the cocoa; stir until combined and remove from the heat. Add the walnuts and vanilla; stir until combined. The fudge will have a very smooth, shiny texture.
Spoon the fudge into the prepared dish. Transfer to the refrigerator until set, at least 2 hours. Or, if you just can’t wait, slip it in the freezer. Run a knife around the edge of the pan and slice into cubes. Heat the knife in hot water and pat dry before each cut for the smoothest slices. Press one side of each piece in the reserved crushed peppermint. Store in an airtight container at room temperature for up to 1 week.