Let's look at an example of using the proper functioning of a code and understand how they basically
look now, in our case, we are having the functions and trip message is and the message is, which
are basically as a wrapper functions.
Now, each of these functions called the method that is translated, my suggestion, which is wrapped
function and return, don't value that particular task that the message is written now.
We will look at this translated message is still a qualitative decision, but because both Apple functions
use the same function, we need to modify only one function instead of two functions, which is encrypt
messages and decrypt.
Now with this Reppel functions, someone will import a program that we have created and call a particular
function name and message Asgeir or decrypt messages just as they can with all the other cipher programs,
programs, Apple functions, have clear names and tell others who basically use the function that will
do the function without having to look at the code.
So as a result, if we want to share our code, others can also use it more easily.
And other programs can encrypt the message in various silos by importing the Saiful programs and calling
the encrypt messages functions as we can do it, like importing the program and seeing the program name
both the encrypt messages.
So naming consistency is helpful because it makes it easier for someone familiar with one of the Saiful
programs to use other Saiful programs.
For example, you can see that we can see the first parameter is always a second parameter is always
a message, which is the convention used for most of the Saiful programs.
So using a translated message is still a function.
Instead of a separate encryption, the group functions would be inconsistent with other programs.
Now let us look at the code that we have given for translate message ASDF function.
Now the translated message is still function is used for both the encryption and decryption.
But notice that the transmitted message Asgeir has a parameter for key messages and also a third parameter
named Modesta.
Now when we try calling translated message Astarte, call in the encrypt function passes and encrypt
string to Monastir.
Similarly, from the decrypt function, it is passing the string decrypt for Modesta.
Now this is how we translate messages gitanos whether it should be encrypted or decrypt the given message.
So the actual encryption process is simple for each letter in the message parameter function, lookup,
start letters index in your letter this year and replace it.
That connected with the letter at the same index in the key parameter.
So decryption does the opposite.
It looks up the index in keys and replaces the characters with the character that the same index in
letters is now instead of using letters and the program uses of variables that even and B1, which allows
it to replace the letters in CAD even with letters, add the same index and not even being able to change
which values are assigned to add even.
And Beevor makes it easy for the program to switch between encrypting and decrypting.
So here we are sending the characters in that, even to characters in letters, and then connect those
and be one to the characters in the keys.
If we can look over here now, keeping in mind that the goal in this particular method always replaces
the characters, even with characters in the same index and Beevor.
So when we swap the values, the code does the decryption process instead of the encryption process.
And then the next line in the program finds the indexes to use the encryption and the decryption.
Now we have a for loop here, which says the symbol or the same variable to a character in the message
is the string on each iteration through the loop.
And if the uppercase form of this symbol exists in God, even then it finds the index of the uppercase
form uppercase form of the symbol in Cat A1 and same index variable stores this index.
Now we already know that defined method would never return, minus because we are from defined matter.
It means that argument could be found in the string.
So because of the if statement guarantee suggests it will not exist in even otherwise, we won't have
been executed.
So in each encrypted or decrypted symbol to build the string that is only translated message is still
function.
But because the key and the letters are both only in uppercase, we need to check whether the original
symbol and message was then adjusted or the encrypted symbol lowercase.
Now, for doing this, we have to learn to string methods, which is is apparent is lower.
So moving on to is opponent is lower string methods.
The store methods check whether the string is in the application lowercase.
Now more specifically, it is a postering method.
Returns to evoke the conditions are meant that a string has at least one uppercase letter.
Australia does not have any lowercase letters and is lobstering method written through both of the conditions
are met that this strain has at least one lowercase on the string, doesn't have any uppercase letters.
So this nonlocal little characters in the string doesn't affect whether this method semitone true or
false.
Although both the letters evaluate to force, if only non existent does not reject this.
Suppose we just go to the interactive shell here and we try to enter in this see python.
Then Dot is Apple press and we get to all.
We enter python.
Hacking, one, two, three, dot, is Apple still related to all of the Internet and lowercase and
check is.
Law.
We get it, or if we see one, two, three, vote is up.
This will be false.
Or if we see just a blank and saying is, look, this is also false.
So in this, for example, returns true, OK, because all the characters has at least the text that
we have written has at least one uppercase in it and all lowercase.
The numbers in the string doesn't affect the evaluation.
In the second one we have to check for is lower.
OK, now this also returns true because a string python has at least one lowercase letters in it and
no uppercase.
And now let's return to our code, which we have written to see how to use these approaches, lower
string methods.
So if we come over here, we have checking.
This is a portal is lower in the for loop in the same way right now.
In the program that we have written, we have used here is appearance's lower string methods to help
ensure that the cases of the plaintext are reflected in the ciphertext.
So here we are checking that is we are checking it for this, converting to Upwood over here first and
then we are checking if it doesn't appear.
What are you supposed to do if it does not end up also develop?
So then what you're supposed to do.
So over here, we first check whether the symbol has an uppercase letter, if it does concatenate the
uppercase version of the characters Addicott V1 to be translated Ostia.
So this results in the uppercase version of the key character corresponding to the uppercase input.
Now, if this symbol instead has a lowercase correct, then it concatenate the lowercase version of
the characters from guys.
We want to be translated next.
OK, so if it is upper concatenate to Apple, if it doesn't look, concatenate to the lower one.
So if the symbol is not a character in the symbol set, such as any number or a question mark or a comma,
it would return false and would execute instead of executing this.
So here it will just execute the next part of the statement.
So if your symbols are not letters, then this means that we cannot and decrypt the character in the
symbol.
So we simply concatenate to the end of the translated acedia like over here we have done in this case.
OK, so at the end your message is your function will return the value in the translated SDR variable,
which contains the encrypted or the decrypted message.
Now let's look at the GEGE random key function to generate a valid key for a simple substitution cipher.
Now typing this particular matter for a key that contains each letter of the alphabet can be difficult
to help this.
We have this get a random key estar function which returns a valid to users I would randomly scramblers.
The characters in the letters are constant mightly.
We are seeing random for leakiest.
OK, now do use this.
You can just substitute said this particular method name that is get a random start and you can substitute
this over here in Mikie.
So let us just come into this and we would again write down.
My guess is equal to say get random.
Now let's check the output.
OK, so now if we execute this thing, it is generating some random key and that is a decrypted message
used for it.
So in this way, we can also execute this particular part.
And after this execution, the last part that we have is checking that at the end of the program.
Call me if it is being run as a program instead of being imported as a model by another program.
Hence we conclude that our simple substitution cipher program is very much easy as compared to others.
Type of program that we have done is basically substituting this character by character with some different
characters.
OK, so that is how we have created the program and understood how the program has been created.