What did Turing's mysterious small programme on the Manchester computer calculate?
You're right that this has to do with encryption, but it's not encryption per se. It's something called hashing. What his program does is take a number, hash it, and output the hash. What Turing created is now called a cryptographically secure hash. 

A modern cryptographically secure hash must do the following. It should be easy to hash the input, but very difficult to 'unhash' an output to get the input. In this case, "very difficult" usually means "it would take months or years on a supercomputer, if not even longer."