Yeah, Jooel found the flaw. Under certain circumstances, when the plain text contains a lower-case character and the cipher key does not, the resulting output text might not contain lower-case characters. In that case, the decryption routine would only work with a cipher tableau containing numeric and upper-case alpha charatcers and fail to properly decrypt the text.

Re: word shift. Just think of each word as it's own little encryption/decryption task with it's own cipher tableau. Since whitespace is passed through the en/de-cryption routines, the output will contain the same number of words as the input. Thus, the way the characters shift from the first cipher tableau to the second cipher tableau are maintained as well. The result is if I for example encrypt "the the", the the first "the" would use the cipher tableau starting as


and the second cipher tableau would start with


Each "the" would end up with it's own decrypted text even though we only used a single cipher key (actually, we did use two, as the definition of the character shift based on the number of words can be considered a second key).

BTW, Richard H.s Vigenere UDF is prepared to handle these different cipher tableaus.


what happens if the shift size is greater than the length of the word?

The shift should not have any relations to the length of a single word. Each word is encrypted with it's own cipher tableau that is constructed based on the position of the word inside the sentence.

Edited by sealeopard (2004-07-25 02:54 PM)
There are two types of vessels, submarines and targets.