1 00:00:00,210 --> 00:00:07,440 So now here we are having a for loop for Saiful Ward, one indecipherable list, a stop in this getting 2 00:00:07,440 --> 00:00:10,010 a new SAIFULLAH mapping for cipherText World. 3 00:00:10,020 --> 00:00:15,210 We are seeing candidate map last year is equal to get the blind side Fullarton mapping swane. 4 00:00:15,600 --> 00:00:19,560 Then we have the vote pattern this year which is calling them make lopatin one. 5 00:00:19,570 --> 00:00:21,150 Don't get the vote pattern. 6 00:00:21,150 --> 00:00:25,170 Instead of passing this Saiful vote in this as the parameter then it checks. 7 00:00:25,170 --> 00:00:31,370 If your vote pattern is just not in the vote patterns, not all patterns then you are saying continue. 8 00:00:31,590 --> 00:00:35,490 Now this vote was not in our dictionary so we are saying to continue. 9 00:00:35,880 --> 00:00:41,090 Then later we are saying at the letters of each candidate to the mapping for that we are saying for 10 00:00:41,100 --> 00:00:44,880 a candidate, one in your vote patterns, one not all patterns. 11 00:00:44,880 --> 00:00:50,730 Parsing that word pattern is still in that we are seeing Adlard, those two mapping, parsing the candidate 12 00:00:50,740 --> 00:00:53,970 s my best Saiful vote one and the candidate one. 13 00:00:54,090 --> 00:00:59,880 Then we intersect the new mappings with the existing intersected mapping by saying intersected map one 14 00:00:59,880 --> 00:01:06,270 is equal to the Intersect mappings function barcin that the existing intercepted mappings and the candidate 15 00:01:06,270 --> 00:01:06,630 maps. 16 00:01:07,290 --> 00:01:13,860 So here we are getting a new blank cipher letter mapping from the function that is get blank Saiful 17 00:01:13,950 --> 00:01:17,660 the mapping here and it stores this in the candidate maps. 18 00:01:17,730 --> 00:01:26,010 We are able to find the candidate for the current Saifullah to recall to get vote pattern in the makework 19 00:01:26,010 --> 00:01:26,460 pattern. 20 00:01:26,460 --> 00:01:34,560 One module and in some cases decide for maybe name or very uncommon vote that doesn't exist in the dictionary, 21 00:01:34,560 --> 00:01:39,320 in which case in this overall pattern likely won't exist in the vote pattern. 22 00:01:39,750 --> 00:01:44,820 So if the vote pattern of this if a vote doesn't exist in the keys of your old pattern dictionary, 23 00:01:45,060 --> 00:01:48,450 the original plaintext word doesn't exist in the dictionary. 24 00:01:48,480 --> 00:01:48,790 Fine. 25 00:01:49,200 --> 00:01:52,170 So in that case, ASIFA what doesn't get the mapping? 26 00:01:52,170 --> 00:01:57,870 And then it goes on for continual statement, which basically returns to the next five four vote in 27 00:01:57,870 --> 00:01:58,320 the list. 28 00:01:58,800 --> 00:02:05,370 So if the execution we know the vote pattern exist in your old patterns and the value in the old pattern 29 00:02:05,370 --> 00:02:11,400 dictionary, our list of string of the English words would the pattern in the vote pattern, because 30 00:02:11,400 --> 00:02:15,840 the values are in the form of a list we use for loop to trade over them. 31 00:02:15,870 --> 00:02:21,420 Variable candidates said to each of these English words, string on each iteration of the loop. 32 00:02:21,630 --> 00:02:30,390 Then we call the add on the atlatl to mapping one function, which is basically update this mappings 33 00:02:30,390 --> 00:02:31,450 in the candidate map. 34 00:02:31,450 --> 00:02:35,970 I start using the letters in each of the candidates one and then the arrival goes. 35 00:02:35,970 --> 00:02:38,970 Those two mapping one will modify the list directly. 36 00:02:38,970 --> 00:02:42,960 So the candidate map is modified by the time the function call returns. 37 00:02:43,260 --> 00:02:49,350 And after all, those initial candidates are added to decipher Lettow mapping in the candidate, Mubashir 38 00:02:49,350 --> 00:02:56,450 intersects the candidate map with the intersected map and returns the new value of the intersected map. 39 00:02:56,940 --> 00:03:02,280 So at this point, the program execution's returns to the beginning of the loop and to create a new 40 00:03:02,280 --> 00:03:05,520 mapping for the next time forward in this I forward list. 41 00:03:05,790 --> 00:03:11,880 And the mapping for the next five four vote is also intersected with the intersected map, the loop 42 00:03:11,880 --> 00:03:17,870 continuous mapping Saiful words until it reaches the last of all in your Saiful list still. 43 00:03:18,030 --> 00:03:23,850 Now when we have the final intersected cipher letter mappings that contain the mapping for all deciphered 44 00:03:23,870 --> 00:03:31,530 words in ciphertext, we pass it then to the remove all letters from mapping one function to remove 45 00:03:31,530 --> 00:03:34,140 any salt letters at this particular time. 46 00:03:34,290 --> 00:03:38,970 Now the cipher letter mapping return from this removes all letters from mapping. 47 00:03:38,970 --> 00:03:45,630 One is then written for the simple sub function, and now we have the part of the solution. 48 00:03:45,630 --> 00:03:47,880 We can start decrypting the message. 49 00:03:48,150 --> 00:03:51,660 So coming to using the replace string method. 50 00:03:51,840 --> 00:04:00,000 Now over here, if you see just to have a look at initially what we understand might replace string 51 00:04:00,000 --> 00:04:01,860 method over here now. 52 00:04:02,340 --> 00:04:06,540 So you replace string method returns a new string with the replaced. 53 00:04:06,540 --> 00:04:09,580 Correct false argument is a substring to look for. 54 00:04:09,580 --> 00:04:12,550 One second argument is a string to replace those substring. 55 00:04:12,780 --> 00:04:18,600 Now, if we come to our decrypting the message part now to decrypt of a message, we will use the function 56 00:04:18,600 --> 00:04:20,840 that is your decrypt message. 57 00:04:21,240 --> 00:04:23,930 What happens now here? 58 00:04:23,960 --> 00:04:30,460 Also, we are going to use in this particular function the function that is our DECRYPT message SGA, 59 00:04:30,780 --> 00:04:33,240 which is there is no simple substitution. 60 00:04:33,240 --> 00:04:34,370 Saiful demo. 61 00:04:34,920 --> 00:04:43,470 So now for this now or this particular function also decrypts using only Keefe's, not the letter mapping. 62 00:04:43,480 --> 00:04:46,680 So we can't use the function directly to address this. 63 00:04:46,980 --> 00:04:53,430 We will create a decrypt with cipher letter mapping, which is a function created here that takes a 64 00:04:53,430 --> 00:04:58,620 letter mappings, convert the mapping into a key and then passes the key and the message to your decrypt 65 00:04:58,620 --> 00:04:59,520 message function. 66 00:04:59,870 --> 00:05:06,100 And then the function that is decrypt with cipher letter mappings, basically written or decrypted string, 67 00:05:06,410 --> 00:05:12,410 now recall the simple substitution keys of the string of only six characters in the character at the 68 00:05:12,410 --> 00:05:12,830 index. 69 00:05:12,830 --> 00:05:17,920 Zero in the key string is an encrypted character for the character of the index. 70 00:05:17,930 --> 00:05:20,550 One is an encrypted character for B and so on. 71 00:05:20,840 --> 00:05:26,580 So to convert a mapping into a decryption output we can easily read, we will need to create a closed 72 00:05:26,630 --> 00:05:33,380 placeholder key which will basically look like or X, X, X everywhere, which can be used in the placeholder 73 00:05:33,380 --> 00:05:39,830 key because it actually gives users only uppercase letters because not all the letters will have a decryption. 74 00:05:39,830 --> 00:05:46,340 We need to able to distinguish between parts of the key list that have been filled with decryption letters. 75 00:05:46,550 --> 00:05:49,650 And those were the decryption hasn't been solved. 76 00:05:49,970 --> 00:05:54,690 OK, so now let us see how this all comes together in the given source code. 77 00:05:54,950 --> 00:06:01,430 So if we go for this defined decrypt with cipher letter mapping one where it takes parameters of ciphertext 78 00:06:01,430 --> 00:06:07,280 one and let the mappings one in this particular function is going to return a string of ciphertext decrypted 79 00:06:07,280 --> 00:06:13,180 with the letter mappings with any ambiguous decrypted letters replaced with an underscore sign. 80 00:06:13,670 --> 00:06:19,250 So first of all, we will create a simple Sabga for the letter mappings by saying over here the key 81 00:06:19,250 --> 00:06:23,740 is to R is equal to X, multiplied by the length of letters of. 82 00:06:24,770 --> 00:06:29,060 Then we say for deciphering that no one in the letters is to ah check. 83 00:06:29,060 --> 00:06:34,010 If the length of your letter is one of the index of cipher letter, one is equal to one. 84 00:06:34,400 --> 00:06:38,030 If it is, that is if there is only one letter added to the key. 85 00:06:38,060 --> 00:06:42,380 So then next we are saying the key ID x is equal to let us find it. 86 00:06:42,500 --> 00:06:46,690 And is the index of X is equal to this. 87 00:06:46,700 --> 00:06:53,990 I don't want now he'll be able to create a placeholder list by Freeplay or replicating a single item 88 00:06:53,990 --> 00:07:01,290 list that is X in this case twenty six times because we have or multiply it by length of the letters. 89 00:07:02,750 --> 00:07:09,650 So when we used on all of this on a basically list and integers, the multiplication operator performs 90 00:07:09,650 --> 00:07:11,220 the list replication. 91 00:07:11,570 --> 00:07:17,370 So next we come to the fore loop which checks each of the letters in your letters SDR for the cipher 92 00:07:17,420 --> 00:07:18,310 little variable. 93 00:07:18,590 --> 00:07:24,320 And if this little one is solved, it replaces X with the placeholder with that letter. 94 00:07:24,770 --> 00:07:27,430 Now the letter mappings one at the index of five. 95 00:07:27,480 --> 00:07:33,410 Little one is the decryption letter and the key index is the index of the decryption letters and letters 96 00:07:33,410 --> 00:07:37,340 hestia, which is written from the find method here. 97 00:07:37,520 --> 00:07:40,520 It sets this index in the key list of the decryption letter. 98 00:07:40,530 --> 00:07:44,480 However, if this letter doesn't have a solution, the function. 99 00:07:44,480 --> 00:07:51,950 And so it's an underscore sign for that particular letter to indicate which characters basically remain 100 00:07:51,950 --> 00:07:52,660 unsolved. 101 00:07:53,030 --> 00:08:00,350 Then we replace the lowercase letters over here in this cipher letters with an underscore and replaces 102 00:08:00,350 --> 00:08:02,960 the uppercase letters with that underscore.