Well, not before proceeding to the next session of encrypting and decrypting, using files, we will
do another example of or implementing the column in the transposition in Python.
So let us create your own new file and let's try and do it using import map.
First, we will create the Otaki and we will give your text see hack, for example.
Now for encryption, we are going to define a method that is encrypted message SDR in which we would
pass the Amnesty SDR as a parameter.
And here we will define the cipher as equals to blank initially.
Then we would track the key indices by giving the key underscore IDEX that's equal to zero.
Then we give here the message length that's equal to convert to float the value of lenth message SDR.
Similarly next, we will take a mystery list or a list that's equal to we convert to list the value
of messages and then we take the key a list that's equal to Sautter in bracket.
We would pass list and bracket the key.
And after this, let us calculate the column of The Matrix.
So let's create your column Mystère.
That's equal to the length of Kiester and calculate the maximum rule of the matrix by giving rule is
equal to say in brackets.
Matt Dot SEAL will use in bracket the MSJ length alien that we have created divided by the columnist
here.
That would be our value for rule that we are calculating.
Then let us add some padding characters they underscore in the empty and the empty shell of the Matrix.
So for that we will see Saiful null variable that is equal to will convert to integer the value of zero
multiplied by the columnist minus the MSJ lib.
After this, we create the message list that we create thought we use the extend method, and here we
give an underscore sign multiplied by see the value full knowledge that all your one, which we create,
then we create metrics and we insert the message and the characters rule values in this.
So we create the same Matrix star variable, which is equal to our message list.
Variable in the.
Let's take a call I plus the value of columnist here and here.
We say for high in the range and we give here to zero comma the length of message list, comma the columnist
here.
Close the bracket now, we will read The Matrix column is using the key, so for that, let's take four
and the score in the range of columnist here.
And in this we would write down the current index is equal to the gayest year DOT.
Find out the index of key list in the market, the value of key on the score index or index.
Then don't forget to close the round bracket, then recreate the cipher SDR.
That plus is equal to blank.
Then dot join and your we rule in bracket the current idex close it and after this we save for a rule
in the Matrix SDR.
Close the brackets, create here the key and score.
Elix as class is equal to one.
After this written statement we would say here the return as value of Forestier and that is what our
encrypted messages are.
In the same program, we would define another method for decrypt the message.
So let us go for the finding of decrypt message estimate, which again takes your cipher SDR parameter,
because whatever we have encrypted that parameter only has to be parsed for the decrypt message.
So now when this decrypt message is still recreated, MSDS are variable that's equal to blank.
Again, we would need to track the key indexes.
So we'll take your key underscore idea that initially equal to zero to track the message and Dice's
we will take a misty eyed ex that's also equal to zero.
The message length that's equal to our float in bracket.
The length of your cipher steer and message enlistee that is list is equal to convert to list the value
of cipher acedia.
Now, after we have got all the values, we would calculate the column of the Matrix.
So let's take all the mysteries equal to the length of gearstick after which we say the rule is equal
to convert to integer say Matt Dot seal use the message and MSJ length divided by the column is still
value.
That is your value for rule.
And then we would convert the key into the list and sort alphabetically so we can access each character
by its alphabetical position.
So we say after this the key, a list is equal to use here sorta method and sort of the values using
the key SDR.