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

So, now it is a lot shorter (thanks to the inspiration by Ayam Chan) and works fine. Am I allowed to publish the complete code? Or is that not appreciated? Greetz


1

First of all, you should consider revise your code in order to group some of those for loops and reduce the number of lines. It will be more readable for you and for others. You have two separate group of loops for getting the values in gxsum.... and gysum... when it would be easier to get them in one group. In fact the conditions of the 3x3 matrix around ...


1

You can just go ahead and treat it as an integer. If, for example, plaintext="bar", plaintext[0]=b=98, and you can just perform operations with it, such as plaintext[0]+1, which will yield 99.


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