By the time the for loop is done, looping the ciphertext is variable will contain the complete string
of encrypted message.
So on each iteration of the loop symbols, variable is assigned a single character from the message
Istria.
If this character exists in Symbolistic, which is our symbol, set the index and symbols Izturis is
and assigned to the symbol next on the next line over here where we are checking that that to encrypt
the text, we need to calculate the index of the encrypted letter so we'll see the symbol index by key
A1.
And if we add it to be able to produce the given output and then it more to the result by the size of
your symbols that represented by expression length in brackets.
Symbolistic know modding by Lance Embellisher handles the wraparound by ensuring the calculated index
is always between zero and up to, but not including the length of symbolistic.
So the resulting number will be indexed in the simplicity of the encrypted character would just concatenate
them to the end of the string in your ciphertext.
Hestia.
So everything in the previous that we have seen is done using a single line of code over here Modeselektor.
So if your symbol isn't an obvious implicit symbol is concatenated to the end of the ciphertext or what
else, the quotation marks on the hyphen in the original message are not in the symbols set and therefore
they are concatenated directly to the string.
So after this code is iterate through each character in the message string ciphertext, Astarita should
contain the full encrypted string which returns encrypted string from the particular function that this
encrypt messages.
So now let us understand writing the decryption function.
So here we have returned this value for the encrypt messages.
OK, now you're the decrypt message start function that the crypto text is almost the same as our encrypt
messages.
So here we have this keys.
We check the key estar, we create a plain text and here we are using the crypto one for finding the
more involved.
OK, so instead of multiplying by even the decryption process multiplies by the modular inverse of the
more inverse is calculated by calling the crypto math one don't find more inverse, which we have already
seen in the earlier session.
Now after this, if you see the for loop, this is almost identical to the message is still the only
difference comes over here when in the encrypt message, the symbol index was multiplied by one and
then he even was added to it in the decrypt message function, the symbol index post, subtract the
key one over here.
And so subtracting after the key, even from the simple index, and then it multiplies it by remodeler
and then add more to this number the size of your symbols, and that is the length of your symbolistic.
Now this is how the decryption process undoes the encryption.
Now let us look at how we can change it so it can randomly select the valid keys for a fine Saiful So
we move on to generating the random keys.
Now if you look at over here in your program, we have this get random ATSDR.
Now it can be difficult to come up with a valid GUI for a fine cipher so you can instead use the get
random estar function to generate a random butta wanted to do this, simply change that to this particular
lake here we are seeing now if we just go about we are giving here see the value of my guest out here
now instead of giving a key value here, we can see all this get.
Now, how have you define this, get random to give this and also we are giving here 60 percent is and
we are presenting the value in the mixture.
So now the program randomly selects and printed to the screen when it executes.
Now, let us look at how they get random function.
VOKES So let us go below and compare this function here.
We have entered a loop in this very condition is through this infinite loop will loop forever until
it is told to return to the user terminates the program.
Now, if your program gets stuck in an infinite loop, you can dominate the program by placing controls
on windows.
OK, so get the random can function will eventually exit the infinite loop with the written statement.
Now here we are determining the random numbers between two and the size of the symbols set for each
event and V1.
Now this code ensures that there is no chance that even a B one will be equal to the invalid value zero
or one.
The if statement checks over here that we have given it checks to make sure that the key is relatively
primed with the size of the symbols set by calling the GCD function in the Cryptome at one module if
given is relatively with the size of superset, then these two randomly selected keys are combined into
a single schema multiplying given by the same size and adding we want to the product over here.
Now this particular line that is a written statement, it basically returns the value from the get random
astar function.
Now, if the conditioned response was the old loops back to the start of the pilot and picks a random
number for each one, and we want to give infinite loop, and that program continues looping until it
finds random numbers that are also valid.
Now, after that, the next thing that we have is just the similar one, which is calling the main function
of this program was run by itself rather than being imported by another program.
So this ensures that the main function runs when the program is running, but not when the program is
important as a module.
So now if we try to execute this.
Now, we have done this for decrypting let us go back for encryption, so now we have used see the keys
to seven to three in this case and the decrypted extras over here.
So let's go back here and let's write down all proper text.
Let's let this.
And right down here.
So this is and simple program for a fine Saiful encryption of the text, you will see the
output.
Shortly after executing Let's save this and we will change this to and let us run this.
So now what gate has used for three three three is the Valerica, which it has used for encrypting this
particular message.
So with this, we have completed the spot.
Now we will move on to the next session where we will see hacking this afine Saiful.