How long can table salt last in its original packaging, unopened? Ditto for sugar. What do you do if they harden?
The short answer in both these cases is "forever." Neither salt nor white sugar ever goes bad, whether the package is original or sealed. I daresay that if the original excavators of Pompeii had found a box of sugar buried there, they could have used it to sweeten their espresso. According to Domino Sugar's website, sugar (also known by its chemical name, sucrose) "has an indefinite shelf life because it does not support microbial growth." This is why fruit "preserves" are made by cooking up fruit (very perishable) with sugar (not perishable at all).
White sugar prefers a dry environment. When that is breached, it may clump. In which case: put it in a resealable plastic bag and whack it with a rolling pin. Thereafter, store it in a container that keeps moisture out. Brown sugar (white sugar mixed with a bit of molasses) also will last indefinitely, but here you want to keep moisture in. If brown sugar hardens, put it in a deep glass bowl and cover the bowl with a damp paper towel and then either a microwavable lid or plate. Microwave about a minute, then break up the sugar and repeat until it has softened sufficiently.
As for salt, what you're actually eating when you consume it is a mineral, sodium chloride, that has been around for billions of years, either sitting in rock deposits (whence comes table salt), or dissolved in the ocean (sea salt). It will be around long after you're gone. Even more than sugar, salt has been used for millennia to preserve other foods -- ham, salt cod, olives -- that would otherwise spoil.
Some fancy sea salts, such as fleur de sel, still have a bit of moisture in them and you'll want to put these in a sealed container to keep them from drying out. (If they do, just whack with a rolling pin.) While kosher salt and sea salt will last forever, table salt may not. Morton iodized salt, for example, also contains calcium silicate (an anti-caking agent), potassium iodide and dextrose (which stabilizes the iodide). According to Morton's website, "the salt itself does not expire, but added ingredients such as iodine may reduce shelf life. The shelf life of iodized salt is about 5 years."
Why can't I easily cut some peaches in half?
This is the time of year when my father can be counted on to ask me why some peaches can be easily cut in half, others cling tenaciously to their pits. This is what I tell him every year:
All stone fruits (peaches, nectarines, plums, etc.) come in both clingstone and freestone iterations. While freestones taste better, are easier to work with and keep longer, farmers grow clingstones as well because they start to ripen earlier in the season, while freestones don't come in until about two months later.