1 00:00:00,150 --> 00:00:05,220 Now, the for loop go through all the twenty six possible cipher letters and looks at this, I followed 2 00:00:05,220 --> 00:00:10,620 a map and a list of your potential decryption letters for this or for that cipher letter. 3 00:00:10,650 --> 00:00:14,700 That is the list at the letter mappings at the index of Saiful Little One. 4 00:00:14,880 --> 00:00:19,310 Then it checks whether the length is equal to or the length of this list is equal to one. 5 00:00:19,410 --> 00:00:25,800 If it is, then we know that there is only one letter that this letter would decrypt to decipher letters. 6 00:00:25,830 --> 00:00:26,410 So. 7 00:00:26,730 --> 00:00:33,840 So then over here we are adding it to the sort of decryption letters to this all letters list and the 8 00:00:33,840 --> 00:00:36,480 sort of letters always add letter mappings. 9 00:00:36,990 --> 00:00:43,020 That is a four letter and they zero because it is a list of potential decryption letters that has only 10 00:00:43,020 --> 00:00:46,580 one string in appendix zero of the list. 11 00:00:46,980 --> 00:00:52,650 So after the previous for loop that has started the those that the variable should contain a list of 12 00:00:52,650 --> 00:00:54,690 all the descriptions of cipher letters. 13 00:00:54,820 --> 00:00:58,830 And at this point the program is done identifying all these old letters. 14 00:00:59,130 --> 00:01:04,080 Then it checks whether they are listed as potential decryption letters for other cipher letters and 15 00:01:04,080 --> 00:01:05,150 then remove them. 16 00:01:05,190 --> 00:01:11,130 So for doing this, then we are having another for loop, which is going through all the possible twenty 17 00:01:11,130 --> 00:01:16,920 six cipher letters and looks at this four letter mapping list of the potential decryption letters. 18 00:01:17,190 --> 00:01:19,930 So here we are seeing four five letter one. 19 00:01:19,930 --> 00:01:23,340 Illiteracy are four is one in this all four letters. 20 00:01:23,340 --> 00:01:28,800 If the length of this is not equal to one and this is in your letter mappings, what are the index of 21 00:01:28,800 --> 00:01:36,240 cipher letters then we are seeing the letter mapping one at the index of five letters. 22 00:01:36,240 --> 00:01:40,260 One is not remove and then we check if it is equal to one. 23 00:01:40,710 --> 00:01:44,070 And that is the new letter is now solved then. 24 00:01:44,070 --> 00:01:49,590 So no loop again and making it loop again to prove it will again continue the loop. 25 00:01:49,590 --> 00:01:56,190 So here before each side fully examines through the letters in this solve letters to check whether any 26 00:01:56,190 --> 00:02:03,380 of them exist in the list of potential decryption letters for the mapping one at the index of cipher 27 00:02:03,420 --> 00:02:03,960 letter one. 28 00:02:04,350 --> 00:02:09,840 Then we check whether the list of potential decryption letters is then solved by checking whether the 29 00:02:09,840 --> 00:02:13,130 length of letter mapping is one of the index of five letters. 30 00:02:13,150 --> 00:02:17,400 One is not equal to one which is over here in this line. 31 00:02:18,000 --> 00:02:22,910 And by checking whether this letter exists in the list of potential decryption letters. 32 00:02:23,160 --> 00:02:29,410 So if both the criteria are met in this condition is returning through, then we remove that sulfur 33 00:02:29,430 --> 00:02:34,590 letters from S1 from the list of potential decryption letters. 34 00:02:34,830 --> 00:02:40,800 And if this removal leaves only one letter in the list of decryption letters, then we again said the 35 00:02:40,800 --> 00:02:46,800 loop again, we're able to prove in this case so that the court can remove this newly solved letter 36 00:02:46,800 --> 00:02:49,460 from the four letter mappings on the next iteration. 37 00:02:49,950 --> 00:02:56,610 Now, after the Vilo has gone to a full iteration without the game being set to prove, then the program 38 00:02:56,610 --> 00:03:04,170 moves beyond the loop and returns the SAIFULLAH to mapping that the letter mapping one over here and 39 00:03:04,170 --> 00:03:10,320 the variable at mapping one should now contain a partial or potential full resolve cipher later mapping. 40 00:03:10,590 --> 00:03:16,680 So now let's come to testing this particular method that is remove letter from mapping function. 41 00:03:17,190 --> 00:03:19,950 So let's see this particular function in action. 42 00:03:20,070 --> 00:03:25,760 Testing it in the interactive shell now will go back to Interactive Shell and where we have created 43 00:03:25,760 --> 00:03:27,240 the intersected mappings. 44 00:03:27,690 --> 00:03:33,690 So let us just cooperate on this function name, which is easy for us to write down over here. 45 00:03:34,140 --> 00:03:37,290 Now we will see what he will see. 46 00:03:37,570 --> 00:03:47,790 Letter mapping is equal to say, simple sub hackl dot this removal of letters from mapping one function 47 00:03:48,030 --> 00:03:54,770 and in this we would be passing, say, the intersected mapping one in this case. 48 00:03:55,230 --> 00:04:02,610 And then let us try to see or let us try to call the Intersect it. 49 00:04:04,400 --> 00:04:05,630 Mapping one. 50 00:04:08,260 --> 00:04:14,560 So once we have done this, but when you remove these sort of letters from intercepted mapping, will 51 00:04:14,560 --> 00:04:16,850 this start now over here on? 52 00:04:16,870 --> 00:04:24,280 Initially we had an M and B, but now here we just have been this, which is what we predicted from 53 00:04:24,280 --> 00:04:25,030 the case. 54 00:04:25,030 --> 00:04:25,600 It would be. 55 00:04:25,840 --> 00:04:33,850 So now each side has just one potential decryption letter so we can use this at the mappings to start 56 00:04:33,850 --> 00:04:34,510 decrypting. 57 00:04:34,930 --> 00:04:40,370 Now, again, we will return to the interactive shell example one more time so we will not lose this. 58 00:04:40,370 --> 00:04:44,990 We will keep this open now coming to a more simple sub function. 59 00:04:45,340 --> 00:04:52,290 So if we go back to our interactive shell and let us open our file again. 60 00:04:52,780 --> 00:04:55,720 So let's go back to you. 61 00:04:55,730 --> 00:04:58,710 Drive your simple substitution. 62 00:04:59,080 --> 00:05:02,840 Now, if we go back to over hack simple sub one function. 63 00:05:03,100 --> 00:05:09,790 So now that you have seen how the function that is inside letter mapping one, your add letters to mapping 64 00:05:09,790 --> 00:05:15,940 one, your intersected mappings one and remove some of letters from mapping one have manipulated the 65 00:05:15,940 --> 00:05:18,160 cipher letter mapping that you have passed them. 66 00:05:18,580 --> 00:05:22,360 So now let us use them in our particular program to decrypt the function. 67 00:05:22,420 --> 00:05:29,080 OK, so now here we are going to define the victory or symbols of one function, which will take a parameter 68 00:05:29,080 --> 00:05:33,910 of message start in that we will see intercepted maps. 69 00:05:33,910 --> 00:05:40,470 One is equal to calling the blank Saifullah mappings cipher wordlist Asgeir in which we are stored in 70 00:05:40,480 --> 00:05:42,250 the known Letrozole space. 71 00:05:42,250 --> 00:05:48,940 But now here we are creating a new cipher letter mapping that, restoring the intersected map. 72 00:05:48,940 --> 00:05:55,280 One variable and this variable will eventually hold intersected mappings for each of the cipher words. 73 00:05:55,720 --> 00:06:03,280 Now after this, we basically remove any known little characters from the messages and reuse the objects. 74 00:06:03,280 --> 00:06:09,160 Object in the known Letrozole space pattern matches in a string that is in the letter or provide space 75 00:06:09,160 --> 00:06:09,710 character. 76 00:06:09,910 --> 00:06:17,020 Then we have this sub function you can see over here if you just move a bit now in this sub matter, 77 00:06:17,020 --> 00:06:18,070 on this sub function. 78 00:06:18,400 --> 00:06:23,200 Now this is basically called on a regular expression and it has taken two arguments. 79 00:06:23,500 --> 00:06:29,320 The function as the string in the second argument for matches, and it replaces those matches with the 80 00:06:29,320 --> 00:06:30,810 string and the astonishment. 81 00:06:31,120 --> 00:06:33,910 Then it returns a string with all these replacements. 82 00:06:34,090 --> 00:06:41,290 And in the example, this method tells the program to go through the uppercase string and replace all 83 00:06:41,290 --> 00:06:43,870 the known little characters with the blank string. 84 00:06:44,080 --> 00:06:49,030 Now, this makes this subroutines a string with all punctuation numbered characters removed. 85 00:06:49,270 --> 00:06:54,510 And this string is story for word, list of variable of which we have created. 86 00:06:54,670 --> 00:06:56,980 Then we execute this forward list. 87 00:06:56,980 --> 00:07:05,470 Variable should contain a list of uppercase letters and the for loop assigns each letter in the message 88 00:07:05,470 --> 00:07:07,420 loosely cipher word variable. 89 00:07:07,750 --> 00:07:12,830 And inside this little code creates a blank map gets deciphered. 90 00:07:12,850 --> 00:07:18,190 All candidates are the candidate letters to decipher letter mappings and then intersects this mapping 91 00:07:18,190 --> 00:07:20,330 with the intersected map. 92 00:07:20,510 --> 00:07:24,270 Now we will see more in detail about this in the next session. 93 00:07:24,310 --> 00:07:25,550 That's it from this session. 94 00:07:25,570 --> 00:07:26,500 Thank you very much.