Hey guys, I am trying to figure out how to do a double transposition cipher.
This is what I have so far to take in a string and then put that string a 2x2 array of a fixed size that I made. I have the key that I want to use for the new 2x2 array, but I don't know how to implement it. Any ideas to help me figure it out? I want to do the work on my own, but helpful hints could really help me out
void transPosition(string b)
{
int key[7] = {4,3,1,2,5,6,7};
//gives d the size of the key
int d = sizeof(key) / sizeof(key[0]);
char matrix[4][7];
//this loop will put the string in a 2x2 char array
for(unsigned int i = 0; i < b.length(); i++)
{
matrix[i/d][i%d] = b[i];
}
//just to check, we use this loop
//to see if the array has the letters
//in order from the string
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < 7; j++)
{
cout << matrix[i][j];
}
cout << endl;
}
}