1 00:00:00,400 --> 00:00:05,460 Well, not before proceeding to the next session of encrypting and decrypting, using files, we will 2 00:00:05,470 --> 00:00:11,330 do another example of or implementing the column in the transposition in Python. 3 00:00:12,000 --> 00:00:18,680 So let us create your own new file and let's try and do it using import map. 4 00:00:18,690 --> 00:00:25,740 First, we will create the Otaki and we will give your text see hack, for example. 5 00:00:26,280 --> 00:00:35,580 Now for encryption, we are going to define a method that is encrypted message SDR in which we would 6 00:00:35,580 --> 00:00:39,760 pass the Amnesty SDR as a parameter. 7 00:00:40,110 --> 00:00:47,020 And here we will define the cipher as equals to blank initially. 8 00:00:47,490 --> 00:00:56,030 Then we would track the key indices by giving the key underscore IDEX that's equal to zero. 9 00:00:56,460 --> 00:01:08,810 Then we give here the message length that's equal to convert to float the value of lenth message SDR. 10 00:01:09,840 --> 00:01:18,540 Similarly next, we will take a mystery list or a list that's equal to we convert to list the value 11 00:01:18,540 --> 00:01:27,300 of messages and then we take the key a list that's equal to Sautter in bracket. 12 00:01:27,750 --> 00:01:32,070 We would pass list and bracket the key. 13 00:01:34,290 --> 00:01:38,790 And after this, let us calculate the column of The Matrix. 14 00:01:39,000 --> 00:01:41,100 So let's create your column Mystère. 15 00:01:41,160 --> 00:01:49,590 That's equal to the length of Kiester and calculate the maximum rule of the matrix by giving rule is 16 00:01:49,590 --> 00:01:52,350 equal to say in brackets. 17 00:01:52,440 --> 00:02:02,670 Matt Dot SEAL will use in bracket the MSJ length alien that we have created divided by the columnist 18 00:02:02,690 --> 00:02:02,940 here. 19 00:02:03,600 --> 00:02:07,040 That would be our value for rule that we are calculating. 20 00:02:07,500 --> 00:02:14,650 Then let us add some padding characters they underscore in the empty and the empty shell of the Matrix. 21 00:02:14,940 --> 00:02:24,390 So for that we will see Saiful null variable that is equal to will convert to integer the value of zero 22 00:02:24,540 --> 00:02:30,690 multiplied by the columnist minus the MSJ lib. 23 00:02:31,940 --> 00:02:41,810 After this, we create the message list that we create thought we use the extend method, and here we 24 00:02:41,810 --> 00:02:49,580 give an underscore sign multiplied by see the value full knowledge that all your one, which we create, 25 00:02:50,120 --> 00:02:57,350 then we create metrics and we insert the message and the characters rule values in this. 26 00:02:57,680 --> 00:03:04,490 So we create the same Matrix star variable, which is equal to our message list. 27 00:03:04,490 --> 00:03:06,050 Variable in the. 28 00:03:06,830 --> 00:03:14,840 Let's take a call I plus the value of columnist here and here. 29 00:03:14,840 --> 00:03:26,720 We say for high in the range and we give here to zero comma the length of message list, comma the columnist 30 00:03:26,730 --> 00:03:27,080 here. 31 00:03:28,620 --> 00:03:38,080 Close the bracket now, we will read The Matrix column is using the key, so for that, let's take four 32 00:03:38,670 --> 00:03:44,160 and the score in the range of columnist here. 33 00:03:44,340 --> 00:03:53,600 And in this we would write down the current index is equal to the gayest year DOT. 34 00:03:54,030 --> 00:04:04,620 Find out the index of key list in the market, the value of key on the score index or index. 35 00:04:06,270 --> 00:04:12,530 Then don't forget to close the round bracket, then recreate the cipher SDR. 36 00:04:13,230 --> 00:04:16,670 That plus is equal to blank. 37 00:04:16,680 --> 00:04:29,820 Then dot join and your we rule in bracket the current idex close it and after this we save for a rule 38 00:04:30,000 --> 00:04:33,140 in the Matrix SDR. 39 00:04:33,150 --> 00:04:39,420 Close the brackets, create here the key and score. 40 00:04:40,440 --> 00:04:44,010 Elix as class is equal to one. 41 00:04:44,370 --> 00:04:55,860 After this written statement we would say here the return as value of Forestier and that is what our 42 00:04:55,860 --> 00:04:57,330 encrypted messages are. 43 00:04:57,510 --> 00:05:01,550 In the same program, we would define another method for decrypt the message. 44 00:05:01,890 --> 00:05:13,560 So let us go for the finding of decrypt message estimate, which again takes your cipher SDR parameter, 45 00:05:13,590 --> 00:05:19,810 because whatever we have encrypted that parameter only has to be parsed for the decrypt message. 46 00:05:20,430 --> 00:05:27,210 So now when this decrypt message is still recreated, MSDS are variable that's equal to blank. 47 00:05:28,030 --> 00:05:32,060 Again, we would need to track the key indexes. 48 00:05:32,280 --> 00:05:39,900 So we'll take your key underscore idea that initially equal to zero to track the message and Dice's 49 00:05:39,900 --> 00:05:44,950 we will take a misty eyed ex that's also equal to zero. 50 00:05:45,480 --> 00:05:51,060 The message length that's equal to our float in bracket. 51 00:05:51,180 --> 00:06:02,580 The length of your cipher steer and message enlistee that is list is equal to convert to list the value 52 00:06:02,580 --> 00:06:04,450 of cipher acedia. 53 00:06:05,070 --> 00:06:09,690 Now, after we have got all the values, we would calculate the column of the Matrix. 54 00:06:09,940 --> 00:06:18,480 So let's take all the mysteries equal to the length of gearstick after which we say the rule is equal 55 00:06:18,480 --> 00:06:30,450 to convert to integer say Matt Dot seal use the message and MSJ length divided by the column is still 56 00:06:30,450 --> 00:06:30,800 value. 57 00:06:30,810 --> 00:06:33,150 That is your value for rule. 58 00:06:33,540 --> 00:06:40,830 And then we would convert the key into the list and sort alphabetically so we can access each character 59 00:06:40,830 --> 00:06:42,810 by its alphabetical position. 60 00:06:43,140 --> 00:06:52,050 So we say after this the key, a list is equal to use here sorta method and sort of the values using 61 00:06:52,410 --> 00:06:53,730 the key SDR.