Authentic hardtack (flour, water,& salt) will last almost indefinitely as long as it doesn't get wet. If you use a newer recipe that includes sugar or milk then you might lose some shelf life but I'd probably still feel safe carrying it for a season or so. Some online recipes suggest a shorter baking time to make a softer hardtack for easier eating. That "softness" is moisture and will have a negative effect on shelf life.
If you've never had hardtack before, check your dental plan before experimenting
<img src="images/graemlins/grin.gif" alt="" /> <---This guy has never eaten hardtack!
HTH
Ed