Comment Re:First question: (Score 1) 458
If the method of encryption is a one time pad, then Test_key in general cannot decide when it has the correct key.
A one time pad consists of a bunch of randomly chosen shifts for each letter in the message you would like to encrypt. This has the effect that any specific encoded n-letter message could be decoded to any n-letter string. For example, akldjsadhas could be "hello world" or "hello jenny" or anything you could think of with the required number of letters - with longer lengths, there are far more messages possible, and padding the sent message with some random data to make use of the whole list of shifts can make the task really hard. The idea is that there's too little information contained in the encoded message to decode it.
Of course, there's always the potential for attacks on the one time pad in specific situations: if all the possible messages have different lengths, and you know all the possible messages, then it's trivial to work out what has been sent. The point is that in the general case this - and some other ciphers - cannot be broken.
A one time pad consists of a bunch of randomly chosen shifts for each letter in the message you would like to encrypt. This has the effect that any specific encoded n-letter message could be decoded to any n-letter string. For example, akldjsadhas could be "hello world" or "hello jenny" or anything you could think of with the required number of letters - with longer lengths, there are far more messages possible, and padding the sent message with some random data to make use of the whole list of shifts can make the task really hard. The idea is that there's too little information contained in the encoded message to decode it.
Of course, there's always the potential for attacks on the one time pad in specific situations: if all the possible messages have different lengths, and you know all the possible messages, then it's trivial to work out what has been sent. The point is that in the general case this - and some other ciphers - cannot be broken.