1 00:00:00,210 --> 00:00:07,350 So coming ahead, we are moving for displaying the happy results to the user when the program calls 2 00:00:07,350 --> 00:00:12,750 the brain function to display your a map and one the original message and the decrypted message on the 3 00:00:12,750 --> 00:00:13,620 screen up front. 4 00:00:13,890 --> 00:00:20,520 So basically, we're storing the decrypted message in a variable named as hacked message one which is 5 00:00:20,520 --> 00:00:26,520 copied to the clipboard and printed on the screen so that the user can compare it to the original message. 6 00:00:26,720 --> 00:00:34,560 OK, we then use the the mapping one to find the decrypted message, which is defined later in the program. 7 00:00:34,950 --> 00:00:42,840 So next, we look at all the functions that create of mappings coming to creating the mapping the program, 8 00:00:42,870 --> 00:00:47,550 the follicle mapping for each cipher in the ciphertext. 9 00:00:47,670 --> 00:00:52,440 So to create a complete mapping, we will need several helper functions created. 10 00:00:52,590 --> 00:00:59,570 One of those helper functions will set up a new site for mapping so we can call it for every site for 11 00:00:59,940 --> 00:01:06,990 another function will take over its current mapping and the candidate collection to find all the candidate 12 00:01:07,020 --> 00:01:11,750 decryption what we'll call this function for each Saiful word and each candidate. 13 00:01:12,000 --> 00:01:19,290 Then the function will then add all the potential decryption letters from the candidate for the final 14 00:01:19,300 --> 00:01:22,650 words, like a mapping and then mapping to it. 15 00:01:23,040 --> 00:01:30,150 When we have the mapping for several votes from over ciphertext, we will use a function to merge them 16 00:01:30,150 --> 00:01:36,060 together and then we will use the final helper function to solve as many Saiful as those decryption 17 00:01:36,060 --> 00:01:40,450 as we can by matching one decryption letter to each side. 18 00:01:41,010 --> 00:01:48,510 So I know we won't always be able to solve all this, but you will find out how to deal with this issue 19 00:01:48,510 --> 00:01:51,010 in the decrypting the messages. 20 00:01:51,360 --> 00:01:57,300 So if we come to creating a blank map like we have created over here by defining the function, so we 21 00:01:57,310 --> 00:01:58,790 need to create a blank. 22 00:01:58,850 --> 00:02:06,450 Saifullah, the mapping when we call this blank or get blank mapping one function, it returns a dictionary 23 00:02:06,450 --> 00:02:12,720 with the key to one character string of all the twenty six letters of the alphabet. 24 00:02:12,990 --> 00:02:17,570 OK, now moving to adding the letters to the map. 25 00:02:18,240 --> 00:02:24,080 OK, now the letters to a mapping we have defined and those two mapping one function. 26 00:02:25,570 --> 00:02:29,490 Now this function that we have created takes three parameters. 27 00:02:29,730 --> 00:02:37,830 A Saiful little Nekesa mapping one Saiful war to map Nafisa decipherable one and the decryption vote 28 00:02:37,950 --> 00:02:40,190 safe would be great if that is the candidate. 29 00:02:40,210 --> 00:02:40,910 What now. 30 00:02:40,920 --> 00:02:48,000 The function maps every letter in the candidate one to the little one and the corresponding indexes 31 00:02:48,000 --> 00:02:49,580 position in the civil war. 32 00:02:49,860 --> 00:02:57,360 OK and x that led to the mapping one if it isn't already there, for example, like when initially we 33 00:02:57,360 --> 00:03:03,060 had done on a paper and pen that, for example, if you have set up why that is, but B is a candidate 34 00:03:03,060 --> 00:03:08,460 for decipherable to Etch A Sketch, you then add those two mapping function. 35 00:03:08,460 --> 00:03:09,570 What are the values. 36 00:03:09,570 --> 00:03:15,630 B the key in that mappings, then the function moves to the next leader and appoints you to the list 37 00:03:15,630 --> 00:03:18,380 value paired with the key and so on. 38 00:03:18,390 --> 00:03:22,830 And if the letter is already in the list of potential decryption letters. 39 00:03:23,810 --> 00:03:28,600 Then your ad, Alekos to Mapping doesn't add that to the list. 40 00:03:29,030 --> 00:03:36,980 So, for example, in a puppy, it would be the key for the next two instances because the it's already 41 00:03:36,980 --> 00:03:37,250 there. 42 00:03:37,370 --> 00:03:40,640 So finally, the function changes the value for the EU. 43 00:03:40,910 --> 00:03:44,300 So it has value in its list of the potential decryption levels. 44 00:03:44,600 --> 00:03:47,900 Now, the code in this ad goes to mapping. 45 00:03:47,900 --> 00:03:54,200 One assumes that the length of your sizable one is the same as the length of candidate one because you 46 00:03:54,200 --> 00:03:59,380 should only vote on a candidate one third with matching wallpapers. 47 00:03:59,660 --> 00:04:05,630 Then the program iterate over each index in the string, indecipherable one to check if the letter has 48 00:04:05,630 --> 00:04:09,210 already been added to the list of the potential decryption letters. 49 00:04:09,480 --> 00:04:17,000 So when we say for AI in the range of Lenthall Safeword one, we say if the candidate one at the index 50 00:04:17,000 --> 00:04:24,260 of I'm not in the letter mapping one index of five will vote one out, then we let the mapping one at 51 00:04:24,260 --> 00:04:27,340 the index of Saiful one door got Apprendi. 52 00:04:27,350 --> 00:04:28,940 Candidate one at the index. 53 00:04:29,210 --> 00:04:30,590 So we'll use the variable. 54 00:04:30,590 --> 00:04:37,010 I here to agree to each letter of the Saiful vote one and its corresponding potential decryption letter 55 00:04:37,010 --> 00:04:38,900 in the candidate one to index. 56 00:04:39,140 --> 00:04:44,150 We can do this because the potential decryption letter to be added is candidate one of the index of 57 00:04:44,150 --> 00:04:47,570 a four letter word one index. 58 00:04:48,110 --> 00:04:52,550 So for example, of this I followed with a letter to the candidate was copy. 59 00:04:52,820 --> 00:05:00,230 I would start at the index zero and we will use word zero and one zero to access the force levels in 60 00:05:00,230 --> 00:05:00,770 each string. 61 00:05:01,040 --> 00:05:07,220 Then the execution would move on to the if statement and the if statement checks that the potential 62 00:05:07,220 --> 00:05:08,840 decryption letter candidate won. 63 00:05:08,840 --> 00:05:17,270 I is not already on the list of potential decryption letters and doesn't add it if it's already in the 64 00:05:17,270 --> 00:05:17,540 list. 65 00:05:17,690 --> 00:05:24,650 So it does this by accessing this little one in the mapping with your already mapping one and the index 66 00:05:24,740 --> 00:05:32,130 of Safwat Index because I followed one and this is the key of the mapping that needs to be accessed. 67 00:05:32,300 --> 00:05:38,660 Now this check prevents duplicate letters in the list of potential decryption letters, for example, 68 00:05:38,660 --> 00:05:43,470 the full we might be added to the list of mappings, one of the first iteration of. 69 00:05:43,870 --> 00:05:51,380 But when I is equal to that is the code intersection be from candidate at the index to wouldn't be added 70 00:05:51,380 --> 00:05:55,360 to the mapping because it was already added at the full stipulation. 71 00:05:55,490 --> 00:06:02,270 So if the potential decryption letter isn't already in the mapping, it adds a new letter in candidate. 72 00:06:02,270 --> 00:06:10,190 I add to the list of potential decryption that inside those mapping let the mapping one index five one 73 00:06:10,190 --> 00:06:10,720 InDesign. 74 00:06:11,000 --> 00:06:17,750 Now recall that because Python is a copy of the reference to a dictionary parsed for a parameter instead 75 00:06:17,750 --> 00:06:19,700 of a copy of the dictionary itself. 76 00:06:19,700 --> 00:06:21,700 Any changes made to the mappings? 77 00:06:21,710 --> 00:06:26,790 One in this function will be done outside of the agricultural mapping function as well. 78 00:06:27,050 --> 00:06:32,720 This is because both copies of the reference still refer to the same dictionary passed for letter mapping. 79 00:06:32,720 --> 00:06:35,930 One parameter in the call goes to mapping. 80 00:06:35,990 --> 00:06:39,140 So after looping through all the indexes in this, I followed one. 81 00:06:39,140 --> 00:06:43,720 The function is done, adding Lykos to mapping in the mapping one variable. 82 00:06:44,450 --> 00:06:52,120 OK, so now let's look at how the program compares this mapping to that of other sites will vote to 83 00:06:52,130 --> 00:06:53,420 check for the overlaps. 84 00:06:53,830 --> 00:06:57,170 OK, so we come to the intersecting of two methods. 85 00:06:57,420 --> 00:07:00,000 Now we have the simplest function. 86 00:07:00,170 --> 00:07:06,620 OK, which uses the Intersect mappings one to take two, three, four letter mapping fast as its map 87 00:07:06,800 --> 00:07:09,020 A1 and my V1 parameters. 88 00:07:09,230 --> 00:07:15,360 OK, and this basically returns a more mapping of map even as we win over here. 89 00:07:15,640 --> 00:07:22,940 OK, so the Intersect mapping function instructs the program to combine this even and even create a 90 00:07:22,940 --> 00:07:29,570 blank map and then add the potential decryption letters to your blank map only of the existing book. 91 00:07:29,630 --> 00:07:31,760 OK, so to prevent the duplication. 92 00:07:32,000 --> 00:07:38,330 So when we are defining the material for the map, we say intercepted mapping one is equal to get the 93 00:07:38,330 --> 00:07:41,300 blanks for little mappings, which creates all. 94 00:07:41,310 --> 00:07:47,270 Saifullah, the mapping the story merge mapping by calling this method here and towards the written 95 00:07:47,270 --> 00:07:49,250 value in intersect mapping mappings. 96 00:07:49,260 --> 00:07:49,970 One variable. 97 00:07:50,180 --> 00:07:55,730 OK, now before loop or below this which we are using previously for like those one in Lykos. 98 00:07:56,570 --> 00:08:02,420 OK, now in this, through this uppercase letters in the letter, this constant variable and uses the 99 00:08:02,420 --> 00:08:09,410 letters, one that is the variable we have used as the key of map A1 and we will dictionary. 100 00:08:09,520 --> 00:08:11,660 OK, not after giving this. 101 00:08:11,960 --> 00:08:16,980 We are checking whether the list of potential decryption letters of event is blank. 102 00:08:17,030 --> 00:08:23,210 So we do that over here in the if a blank list means that this letter would potentially be. 103 00:08:24,780 --> 00:08:31,620 So in this case, in the of Saifullah mapping just one piece of the mapping list of the potential decryption 104 00:08:31,620 --> 00:08:36,080 letters, for example, the list of potential decryption letters map even is blank. 105 00:08:36,300 --> 00:08:40,940 Then the intercepted mapping list will be copied to list in map vivants. 106 00:08:40,950 --> 00:08:43,380 Hence we are seeing here intercepted mapping. 107 00:08:43,380 --> 00:08:50,400 One at the index of local one is copied or floppy might be even at the time. 108 00:08:50,520 --> 00:08:55,130 Similarly, viceversa is done over here when we check for Vivaan. 109 00:08:55,590 --> 00:08:57,830 OK, so it is copied from evah. 110 00:08:58,200 --> 00:09:01,020 OK now here on the block. 111 00:09:01,060 --> 00:09:06,730 Given who handles the case in which neither map even more map even is blank. 112 00:09:06,990 --> 00:09:15,230 So when the map is not they are not blank, it loops through the uppercase letters in the list of map 113 00:09:15,240 --> 00:09:17,260 even at the index of little. 114 00:09:17,330 --> 00:09:20,310 OK and then check with the uppercase letter in map. 115 00:09:20,310 --> 00:09:24,830 A1 also exists in the list of uppercase letters in Map B one. 116 00:09:25,320 --> 00:09:28,960 If it does, they are intercepted mapping one of the next letter. 117 00:09:29,040 --> 00:09:37,110 One, we are adding this common letter to the list of potential decryption letters by saying so after 118 00:09:37,110 --> 00:09:37,710 the four. 119 00:09:38,010 --> 00:09:42,750 That's all started over here in the is the Saifullah mapping. 120 00:09:42,790 --> 00:09:48,720 Intercepted mappings should only have the potential decryption letters that exist in the list of potential 121 00:09:48,720 --> 00:09:51,800 decryption letters of both even or not even a map. 122 00:09:52,290 --> 00:09:56,700 OK, so this completely intercepted political map is now in the next session. 123 00:09:56,710 --> 00:10:00,290 We look at an example out of an intercepted moppets. 124 00:10:00,570 --> 00:10:02,080 So that's it from this session. 125 00:10:02,130 --> 00:10:04,350 We will see more in the next minutes. 126 00:10:04,680 --> 00:10:05,550 Thank you very much.