Hey folks, I've been having a project with Caesar cipher and Vinegere cipher. I already figured out Caesar one but I'm struggling with Vineger cipher. My encryption code is divided into two parts: encrypt() and encrypt1(). encrypt() method extracts every character and passes it to encrypt1() where all of the encryption takes place basically. I did here the code but it's not giving me any good results. For example, if where is a key password and is the String which should be encrypted as . But my code give something like this . COnsider that the alphabet covers almost everything = Could please smb help me with that? Thanks in advance!
I think your problem is how you are defining keyIndex. It looks like you're actually assigning a character to it. Which "works", because char is an integer type, but it means that it doesn't have the meaning you interpret it as (the number of places to shift the input by).
So, for example, if your password character was 'B' that means you should shift by 2, right? But keyIndex = 'B' = 98.