Program that encodes and decodes strings based on randomly generated codes