The usage of the word cracker as "hard biscuit" comes from the action of cracking it in two. The word cracker as a derogatory insult for "county bumpkin" has origins in the action of these farmers cracking their whips towards their slaves and mules (I condemn that, just so you know, ACLU and PETA). Both of these words therefore go back to the same verb; that verb in turn goes back to the Old English word cracian, which carried the definition "to make a loud noise". Most Old English words go back to Proto-Germanic, and this is no exception: cracian traces to PGmc krakojan, which may have taken a detour through Proto-Indo-European gerg, "to shout" but definitely is of either imitative or onomatopoeic origin. Interestingly enough, cracking codes is actually a play on words and has different origins; it modified the word hacking to make it seem more acceptable.
Hello! I'm Adam Aleksic, a sophomore studying government and linguistics at Harvard University, where I co-founded the Harvard Undergraduate Linguistics Society. In addition to etymology, I also really enjoy politics, vexillology, geography, board games, conlanging, and law.