So now we will all move on with the extreme examples of where we're safer over here.
First thing is we will go for a new fire.
And let's right down here start with see a message.
Now, here we have input from the user saying, see, what would you like to do?
Questionmark, Mark.
And for a new line here, we put the text first, encrypt all on the new lines.
We put the text decrypt.
That is when asking the user what the user is willing to do.
Either he wants to encrypt the text or he wants to decrypt text.
OK, then we say here, if the message variable is equal to encrypt, OK, then we would see print in
bracket, see your message will be encrypted and then you ask for the user on message, like again putting
an input same into your message here.
OK, then you take a variable, say X one and that is equal to you.
Put the value of message there.
Then we take another variable C translated equal to open close single code which is equal to the length
of Macit, the variable message minus one.
Then we run of a loop I is less than equal to zero.
We open the loop, we see the variable translated is equal to translated plus message I then we say
I will do I minus one and.
We just go back one and we put here the value of.
Translated, then we put the code for decrypting in this code, basically that we have given is for
encrypting, right?
So we go back and now we go for else.
If but and here we check if the user have entered initially the value not encrypted, but decrypt.
OK, then in that case, we are asking the printing the value.
See your.
Message will be decrypted again here, also, let's give off and OK, and then we use another variable
message, too, that's equal to V again, give your input.
We say enter the.
Encrypted message, OK, which you want basically to decrypt, OK, then we take Wyvern, that's equal
to the same message, too.
And again.
C translated variable, which is initially blank, we say is equal to use the land function, but this
time for message two minus one.
And again here we say while I more than equal to zero, there is no need for a bracket is
more than equal to zero.
Calling your report translated is equal to translated plus the value of message to at the index.
Then we say I was two again, I'm minus one.
And after which we put in the value of translated variable.
OK, so let us force to see this and we save it in python hacking beginner names at Demo 2.5.
OK, and if we want to run this, we just go to run and see run module.
OK, here we are checking for equality.
So it has to be double equal to OK, so it asks for the text.
Now we say here, right, don't encrypt, OK?
It'll ask for a message.
We see this is Biton
reverse Saiful.
It goes on and on total revulsion again.
Suppose you want to execute it.
So we go back here we again run this module and this time we put it that we want to be it OK and now
we just copy it on the text that we have already encrypted and we get it in the decrypted format.
Right.
So in this way, another example where we're asking our user, what is he wishing to do?
Depending on the user input that he has given, we either execute the value for encryption or we execute
the value for decryption by taking the message also from the user and then encrypting it or decrypting
it.
Now, let's see another example.
So we will close this and let's go for a new file.
And we would create we would first define C encrypt message here.
We will take the parameter C SDR and some key value for Saiki one, for example.
OK, now here we are going to use C encrypt string as a variable that's equal to just a black one.
No value for it.
We run a for loop for I n c SDR and we hope the for loop here.
We check in the if now you know what is this awadi function used for finding the Unicode character for
a particular variable.
So here we are finding it for I.
OK, if that is more than equal to sixty five and we give already for I if that is less than equal to
90, if this condition satisfies then we have there another time is our variable which is equal to VSC
already at the index ie.
Plus the key value that you have given that is key one.
OK, after this we check here if say the temp estie are OK, if that is more than 90 then we take them
as our equals to sit them.
S.T. are for synch C 90 plus we make it sixty four.
OK, so if it is in a similar case, make it to upper uppercase, make it smaller then we can one back
and here we see the variable n c string that we have taken that is equal to c e n c strength.
Plus use this feature for your temp SDR.
OK then we go on for one more back and we go here for his if and here we check if it is already at the
index I if that's more than ninety seven and you are already at the index, I again we open the brackets
here.
If that is less than equal to say one twenty two then you will again see here say temp SDR is equal
to we use Awadi and the index I plus the value of forty one and we check if your temp SDR is more than
one twenty two, calling your retake temp tempesta are equal to temp SDR plus one twenty two plus ninety
six.
And then we say the ANC string variable is equal to IANSA string plus convert to character of Demoustier.
OK, now after this we move on here and go for the spot, which means none of the above conditions are
true.
Then we see in the string is equal to IANSA string plus the character value of already at the index.
I lost the key value.
OK, now after we have done this, we have to simply say.
Written in C string value.