Now, here we have already written the program because it is a very big demo, we would be understanding
what the demo is all about.
So over here we have started with the import statement of AI tattoos and E then we are importing our
also created programs.
That is Virginia's AI for the month then of a paperclip frequency analysis and check English.
Now, once we have imported all, we start by creating the little star and giving all the alphabets
in the capital letter.
Then we have here a silent mode created which is initialized to false.
Now it is said to be true.
Then the program doesn't print anything.
Hence we have such to do for this second or third one.
We have NOM most frequency letters which is set to form and this is just attempt this many letters because
that is what we are trying to see here.
Next is we have the max length which is said to 16 that is will not attempt give longer than this.
And the known little pattern here we are using our to compile and capital Aitel Zet.
Then we start by defining our main method here.
OK, so inside the main method, we have first of all, taken the ciphertext in the decrypted format.
Then we have taken the hacked message as we are ready and we are calling the Hack Virginia function,
which we will be creating below and parsing the same ciphertext.
Then we say if you're hacked, message a star is not equal to none.
You print copying message to print the value of hacked message and then use Paperclip to copy the value
of hacked message.
Acedia is if it is equal to none, then you fail to hack the encryption.
Now that's it from your main function.
If you look at other functions that we have created, out of which the first is fine, the repeat sequence,
basic function.
Now this goes through the message and finds any three to five letter sequences which are repeated.
It returns a dictionary with the key of the sequence and the values of the list of spacing.
That is number of letters between repeats.
Now here we will be using a regular expression to remove the known letters from the message.
So first thing that we are doing over here is creating an object of message and passing on letters underscore
pattern, lots of blank and message talkable.
Then we have sequence spacing created which basically compile a list of your sequence length of letters
sequences found in the message.
So these basically are your keys are sequences and values of the list in spacing then mirana for loop
for sequence length in the range of three to six, then you start the sequence, start in the range
of the length of message minus sequence length and you determine what sequence is and stored in the
value of sequence over here.
You OK then you look for this sequence in the rest of the message by using this for loop here.
That is for I in the range of sequence start plus the length comma length of the message minus the sequence
length and then check if message in the index of I call and I play sequence lend is equal to one, which
means found the repeated sequence there.
Then you see if sequence not in this sequence spacing you initialize the Blankley's by giving sequence
spacing at the index of sequence is equal to black after which you are upending the spacing between
the distance, between the repeated sequence and the original sequence by saying the sequence spacing
at the index of sequence got up and I minus the sequence start and finally you return the value of sequence
missing.
The next useful function over is get useful factors passing that parameters.
Now this returns a list of useful factors by num by useful remain factors less than the Max Garland
plus one and not one, for example.
So get useful factors.
If you pass one forty four it will it should return Z two, three, four, six, eight, nine, twelve,
sixteen, something like that.
So inside this function we are force checking.
If the value of NUM is less than two, then we return blank.
So no less than to have no useful factors.
Hence just return the blank values there.
Then you say factors is equal to that in the list of factors is found now.
When finding factors, you only need to check the individuals up to the Max Guillain.
So hensman unaffordable you're saying for I in the range of two to the Max Garland plus one that is
don't test one.
It is not useful to start from the two we check here if.
This has to be below, so then we check here that if no, Modelo is equal to zero, we are seeing factors
that appen and other factors is equal to convert to in the value of num divide by.
And if other factors is lower than the Max Skillern plus one another factor not equal to one, you're
upending the valuable factors.
And finally, you're seeing red on the list.
That is, remove the duplicate factors.
The next function in the particular metal or the file we have is get the item at index one, which is
just returning the items at the index one because items this past year as the parameter, then we have
get the most common factors, which is taking a parameter sequence factors.
Not in this.
The first we will get a count of how many times a factor occurs in the sequence factor.
Hence we have de facto counts, which is initialized to Blacula.
That is value is how often it occurs.
So here we see the sequence factors.
These are sequences, values, a list of the factors, the spacing sequence factors has a value like
the gift you should have two, three, four, six, nine, 12, something like that, or LW should have
some different values.
So here we run the four four sequence and sequence factors.
The list is equal to the sequence factor, to the index of sequence.
Then we run another formula for factor in the factor list and check of the factor is not in the factor.
Count your initialize it to zero and incremented by one and then create factors by count, which is
equal to blank.
Now here we should put the factor on its count and what people and make a list of this tuple so that
we can sort them.
Hence we are creating a war hero pupil for the next.
We create another for loop saying for fact that in fact counts.
We exclude the factors which are larger than the max skill and hence we the effectiveness less than
the max skillet, then we are saying to appendix.
So the factors by count is the list of Dupas and the factor by account has the values like the three
four, ninety seven or Tecoma forty seven, something like that, by using the append.
Then finally we say so the list by the fact, the count by saying factors by counterassault saying is
equal to the get items at index one and rouble's equals two two.
Similarly then you will have to return the value of factors by count.
Now after this we come to our main definition of the function.
That is your definition for the examination function, which takes ciphertext as the parameter.
And here we find out the sequences of three to five letters that occur multiple times in the ciphertext.
So they repeat the sequence spacing has a value like something C X is one nine two two or three three
three nine nine seven to do something like that.
So first thing we do over here is we take the repeated sequence spacing and that is equal to we call
the function, find the sequence spacing function, then you can see that get most common factors,
sort of description of sequence factors which we are defining, executing a four four sequence in the
repeat of sequence spacing and add the values to it.
Then finally to see the get most common factors.
Your description for the factors.
By count, we are taking your factors by count equal to get most common factors in the bracket.
We pass the parameters of sequence factors.
Now we extract the fact accounts from the factors by count and put them all lightly, give length so
that they are easy to use later.
Hence we are creating this blank all likely killens, which is nothing but an created value then.
And in that, what are we trying to append?
We say here for doing tuple and factors by count your opinion, the value in all likelihood, Yealands
OK.
And finally you're returning the same unlikely, likely killens from the method, this ASCII examination
function.