Welcome to the first session in a row by phone hacking, intermediate level court now in the last course
of in the last session, we have used the transpositions file Saiful to encrypt and decrypt the entire
file, but we haven't tried writing a brute force program to decipher no messages encrypted with the
transposition file.
A cipher can have thousands of possibilities, which your computer can still easily brute force, but
you would then have to look through thousands of descriptions to find the one correct plaintext.
Now, as you can imagine, this can be a big problem.
But there is a workaround for this.
When the computer decrypt the message using the Ronke, the resulting string is garbage text.
Instead of a normal English text, we can basically programmed the computer to recognize when or decrypted
messages English that we if the computer decrypts using the Ronke, it goes on and tries the next possible
case.
Eventually when the computer dries up the decrypts to English text, it can then stop and bring that
to your attention, sparing you from having to look through thousands of incorrect descriptions.
So basically, let us see, how can a computer understand English?
Now, basically a computer can't understand English, at least not in the way that human beings understand.
Now, computers don't understand even math, chess or human rebellion's either any more than a clock
understands lunchtime.
So computer just executes the instructions one after another.
But these instructions can mimic complex behaviours to solve the math problems when the chips are down.
The future leader of a human resistance.
Ideally, when we need to create a python function, for example, is English function.
That is, we can pass a string to it and get a written value through if the string is English or force
if it's some random or gibberish in that particular case.
So let us look at some English text and some garbage text to see what patterns they might have.
Now, for example, if we type something like C Python's R.
Your friends, OK, or if you type something like instead of this.
Now, this is not what a human can read, right?
I notice that the English text is basically made up of words that you would find in a dictionary, but
the garbage text isn't because votes are usually separated by spaces.
One way of checking whether a message string is English is to split the message into smaller strings
at each space and check whether each string is a dictionary word to split the message string into some
strings.
We can use the python string method name that is split when checks where each word begins and ends by
looking for spaces between the characters.
Right now we can then compare each substring to each word in the dictionary using an if statement.
OK, now we would all like that.
We would probably wouldn't because it would be tedious to type all of it.
And fortunately we can use the English dictionary files, which are basically text files that contain
nearly every word in English that basically will provide you with a dictionary file, which you can
use.
So we just need to write down the function.
For example, it is English function that checks without a substring is a message or a particular substance
available in the messages are in a dictionary file.
So not every word exists in our dictionary.
Dictionary files might be incomplete.
For example, it might have the word names it all, but there are some perfectly good descriptions that
might have non English words in there, like, for example, Xavi w six eight six in s, for example,
like this.
OK, so a plain text could also be in a different language, but will assume it's in English now.
So we would write down it is English function.
OK, that won't be foolproof obviously, but we will give it a try.
And now there is a low probability that a ciphertext that is decrypted using the Ronke will decrypt
to English.
OK, now first thing is we will download a dictionary file for this which we already have created.
And it's basically a text file which is having one word for line in the uppercase.
OK, now we would just add it or and I'll show you after opening it.
All votes do we have.
So let's remove it.
Now, if you go to a drive, we have a folder as an intermediate level where we have created this dictionary
file, which is having one more power line, all in capital, having some English words stored in the
file.
This is basically able to find them dictionary dot the exchange.
Now, we would create a function named is English OK, which will basically split a decrypted string
into individual sub strings and check whether each substring exist as a word in the dictionary.
And if a certain number of such strings of English words will identify that text as English, and if
the text is in English, there's a good chance that will have successfully decrypted a ciphertext with
the correct.
So now we would write down the source code for the English module.
OK, we'll create a new file and write down the code and do it.
OK, so we will create file new file and we will create Sea of Letters this year and we will give all
the letters and packages a, b, c, d, e, f, g, h, i, j, k, l.
And many of you oreste, youve w, x, y, z.
After this, we would create another constant letter and space esteve and that is equal to we have this
little S.T. are with this.
We would concatenate the upper little estie are dot the lowercase characters, all of this.
Plus we would give a space slash D and new line also on all we would concatenate in letters and space.
Then we would define a function.
Now, that is our see law victory and that is Law Dictionary, and in this function, the first thing
we would create is a dictionary file.
And here we would use open and we would give that file, that is.
Dictionary dot, the 60, the one which we have right now, created and saved in the same folder where
we are able to see the current fight.
So after giving this here, we will create the English votes SDR is equal to initially it is blank.
We create for World One in our dictionary file, SDR dot read dot split using a slash and because on
one line we are having one vote.
So we are splitting it whenever we find a new line.
And in that we are seeing English votes as are in the index of vote one, we are saving the value was
none initially.
OK, then we see a dictionary file is still not close and we are returning here and the value of English.
Revolt's still and we end this function here and then we see the English votes.
Our vote is equal to we are calling the law dictionary method that we have created.
So that will get stored in a constant name, English word estopinal.