Hot answers tagged

2

If you run the code with key = "bbb" and plaintext ABC, the result is ciphertext:BACBDC. This is a mix of the properly coded BCD and the original ABC, printing alternatingly from each string. This also shows that the code is printing two letters for each letter in the plaintext. The code is structured as follows: if( <process UPPERCASE> ) {...} ...


1

All of these problems revolve around the index for the key, j, and how it is checked and reset. First, the check: if(j>strlen(argv[1])) Let's say there are 3 letters in the key. strlen(argv[1]) evaluates to 3, but this check is looking to see if j>3. So, this check will allow j to increment to 3. Unfortunately, if there are 3 key letters, the only ...


1

Did you remember to store the end of string marker in cipher? Did you allow space to store it? If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)


Only top voted, non community-wiki answers of a minimum length are eligible