2

I need to create a program, with GUI which can encrypt and decrypt the vigenere cipher. And I would start with saving the tabula recta in an array but I dont really have any experience with doing "bigger" projects. I cant really figure out how to move the alphabet in every line one place further to the left like in the tabula recta.

Sorry for my bad english. I hope someone can help me

public static void main(String[] args) {
    char[][] tabulaRecta = new char[25][25]; // [zeile] [spalte] 
    char[] alphabet = new char[25];
    char a = 65; //erster Buchstabe (großes A)

    for(int x = 0; x < 26; x++, a++) {
        alphabet[x] = a;

        for(int i = 0; i < 26 ; i++, a++) {
            a++;
            for(int j = 0; j < 26; j++, a++) {
                if(a < 91) {
                    tabulaRecta[i][j] = a;
                } else if(a> 90) {
                    a= 65+1
                    tabulaRecta[i][j] = a;

                }
            }  
        }
    }
}

thats all i got so far

Fifi
  • 467
  • 6
  • 17
David
  • 21
  • 1
  • If I understood implementing the tabula recta correctly, you could make a for loop, and on each iteration, do [the first comment under this answer](https://stackoverflow.com/a/7970968/6803997), except that you copy the entire array, and whenever the index for a shifted item would be less than 0, you instead take that resulting index and add it to the last index in the array (adding a negative will subtract, therefore giving you the index you need). – Austin Schaefer Aug 28 '19 at 11:42

0 Answers0