Now, coming back to our transposition encryption algorithm, so let's go back to over Demo 10 over
here.
Now we're going to use the list in our acceptable encryption algorithm to create a ciphertext ASTRAEA
over here.
We're going to see the ciphertext estar open the list multiplied by the year.
Now, each string in the ciphertext Asgeir variable represents a column of the transpositions Saiful
grid because number of column is equal to the key.
You can use this replication to multiply a list with one blank string value in it by the by value in
a particular key.
So the string values will be assigned.
All the characters that go into one column of the result will be the list of string value that represents
each column as discussed earlier.
Now, because the list indexes starts with zero, you will need to also label each column starting at
zero.
So you'll receive ciphertext zero or ciphertext Asgeir zero is the leftmost column and ciphertext ETR.
One is the column to the right of that particular column and so on and so forth.
So over here, the next step here will be adding the text to each string in the ciphertext.
Asgeir as just did it as an example.
Except this time we will add some code to make the computer do it programmatically.
So here we are looping it through the foreach loop.
So we are seeing four columnist here in the range of Gasteyer current ideas is equal to the columnist.
So over here we are looping or iterating once for each column and the column variable has an integer
value to use for the indexes to ciphertext Asgeir on the fourth iteration through the for loop.
The column is still variable, set to zero on second set to one and so on.
We have an index for the string values in the ciphertext Asgeir that we want to access later using the
expression ciphertext Asgeir in the index of columnist.
Now meanwhile, the current index variable who is the index of the message string for the program,
looks at on each iteration for the loop, on each iteration the same or the current index of the same
value as columnist and I will create a ciphertext ETR concatenating the scrambled the message together,
one character at a time succumbing to the argument that assignment operator is not so far that we have
concatenated or added values to each other.
We have used plus operator to add a new value to the variable.
Often when you're assigning a new value to a variable, you want it to be based on the variables current
value.
So you need to use variable as a part of the expression that is evaluated and assigned to a variable.
For example, if you try to enter something in the interactive shell here like C span, that's equal
to say 30 and here we say Hispanic will do span plus four and then we say put in the Valley of Spath,
we get that thirty four printed.
Now there are other ways to manipulate values in the variables based on the variables, current value.
For example, you can do this by using the argument that assignment operators, the statement like for
example, spane plus equal to two, which is used as plus equal to argument and assignment operator
does the same thing as is equal to spend plus two, something like that.
Right.
So just a little shorter to type it.
So the plus is equal to operator Volks with integers to do additions, strings to do string concatenation
and less to do a list concatenation.
So if we go back to our program here, they're more ten now over here.
The value that this we have used to ciphertext Stia.
So over here, the variable that is your current idea is basically holding the index of the next character
in the message string.
Now that will be concatenated to your ciphertext estar list.
And the key added to the current index on each iterations will be to the point two different characters
in the messages to you.
And in each iterations, the current idea is set to the value and the columnist.
You are variable to scramble the string in the message variable.
We need to take the forced character of the message that is over here p and put it into the four string
of the ciphertext STF.
Then we will keep eight characters in the message because the key is equal to eight and concatenate
the character that is after eight to do four string of the ciphertext estimate, we will continue to
skip characters according to the key and concatenate each character until we reach the end of the message.
Not doing so would create a particular string that we have forced us.
We have getting there the value that this Sipi then if you just look at the excel that we have here
and it's B always this default.
The string that would be getting, which is the fourth column of the ciphertext year, then we would
do this again, but started the second character in the message to make the second column.
So inside the for loop that we have in our particular program available, that starts on the particular
next line over here.
It concatenated they write characters in the message to make each column and it loop wildly.
Current idea is less than the length of the message now for each column, the how it reads through the
original message variable and picks out the characters in the intervals of the key by adding to the
current idea.
OK, so after the break you have the message Estado all messages during the bracket in current IDEX
is the false character of the message of the particular first iteration and the character at the message.
Current IdeaCast is concatenated to the cipherText SDR column to start the first column in the next
line.
So in this way, the fourth time, the message zero second time with this message eight and third time
with this message 16, four time with this message.
Twenty four.
That is how we get all the particular values concatenated.
So although the value of the current idea is less than the length of string, but when you continue
concatenating and the characters to the end of the string, add the column index is ciphertext Asgeir.
When the current index is greater than the length of the message, execution will stop there.
And because that isn't good indeed for block after the value, the loop or the for loop iterates column
and sits at the one and the current index starts at the same value as the column.
So over here we will get the values that we have got through the Manual V as we have created.