How would I make a password system for a single-player game like the ones used in older console games?

For example, *Mega Man X* saves work by giving you a series of numbers that you can enter later to load your save.