So now let us continue to define our translate message matter.
So this we have done in the last session.
So now over here we are seeing the fine, your translated message SDR method, which will take the GST
as a parameter, the message SDR as the parameter along with the Modesta, which is either a string
of incorrupt or the that we have already passed in the encrypt messages and the decrypt messages.
OK, so now over here in this definition, we would create see translated as the R is equal to blank.
Now this is basically storing the encrypted or the decrypted message string.
Then we are having the key X, which is equal to zero.
We have the GST that's equal to the GST are thought convert to Apple and after this we run a for loop,
OK, which will loop through each symbol in the message.
So we are seeing for SVM in your message Estie are open for loop and your will take.
No one is equal to similar letters.
SDR don't find in bracket as I am thought, convert to uppercase.
Now we have this letter Estie so that is what we are finding it over here.
And after this we check in the if if the value of no one is not equal to minus one, then you're minus
one means you're as brought up or was not found in the letter Oresteia.
So then over here we are seeing if the mode SDR is equal to the value that is encrypted.
This is another condition we are checking.
Then we say number one C plus is equal to the letter is still not fine.
In Blackett we give the GST up along with the key idea that is.
And if it is encrypting it now, another check would be in the elusive part for the less dear.
If it is equal, do not encrypt but decrypt, then we need to subtract it.
So then we say no one is minus is equal to your we are seeing let Oresteia not find in bracket the GST
are the key x that this subtract if it is decrypted now once this is an active part is also part is
done we go for number one.
Modulo is equal to the length of the letter.
Still that is handle any wraparound if any, and then we would add the encrypted or the decrypted symbol
to the end of the translated by seeing C here.
If we say if I m not is in uppercase, then we see the translated SDR.
That is the variable that we have taken.
We are using the append matter and we are seeing letter Estey are at the index of number to be up and
then again, which is if part and we say is am told is lower then via C C translated SDR got up and
here we are using the letter to our index number one dot lol.
If it doesn't look now after this, then we go ahead foreseeing the key idea X plus is equal to one
that is moved to the next level.
The lucky ones, this is that.
And then you check if your E X is equal to the length of your GST up.
If it is, then you make the X back to zero.
Now we come for this if condition that we have written for this.
If we are giving the A spot here, that is we are telling to open the symbol without encrypting or decrypted.
So then we are seeing C translated as we are not up in the value of X, Y and Z.
And then finally we are using a written statement dot join matter and we are seeing translated as still
to be written.
Now once this is done, then if your current program is run instead of imported as a module, we will
call the main function.
So here we are checking if the name on the score is equal to mean, then we are calling the main method.
So let us again just save it.
As already we have given the name for the file.
Now if we try to save one and run the module.
OK, we are getting the air on line fifty five and 16, let us find out that first.
Let's go to line fifty five or is it is line 16.
So let's go to line number 16 first.
And that is over here.
We are passing the value of my Modesta over here that's encrypted or decrypted is what we to actually
printed.
So let us just examine this particular value that we are printing.
This is page this and then let us see this.
And yeah, so we are getting this particular message that has been encrypted in this case because we
have given the message to be encrypted and not decrypted.
So now over here, let us go to understand the program that we have given.
So first, let's go for setting up the modules, the constants and the main functions of the beginning
of the program.
If you look at over here, this starting when we had started was the important statement for the paperclip
module and a variable called later this year was created, which holds a string of every uppercase little.
Then we have the main function for the original cipher, and it is like the other main functions that
we have, which we have already seen in this advanced level.
And also to this also, it starts by defining the variables for your message, as are your key SDR and
your Modesta.
So then once you have understood all this, let us move ahead.
So the user sets these variables before running the given program.
So the encrypted or the decrypted message, depending on what my Monastir is said to, is stored in
the variable name translated, and then it can be also printed and copied today.
So coming to building strengths with the list upand joined process.
Now let us understand something new in this.
Almost all the programs that we have seen have built a string with gold in some form.
Now that goes the program creates a variable that starts as a blank string and then adds characters
using this string concatenation.
Now, this is what is our previous cipher program have done with the translator Asgeir variable.
Now we can open the interactive shell and let us try entering some details over here or something like
we in building as is equal to lank.
Then we say a loop cesi one in C bitin hacking.
And then we are seeing in this, we say building is glass is equal to see one, and then we give here
print the value of building us.