1 00:00:00,180 --> 00:00:05,910 Now, coming back to our transposition encryption algorithm, so let's go back to over Demo 10 over 2 00:00:05,910 --> 00:00:06,240 here. 3 00:00:06,720 --> 00:00:12,900 Now we're going to use the list in our acceptable encryption algorithm to create a ciphertext ASTRAEA 4 00:00:13,680 --> 00:00:14,390 over here. 5 00:00:14,440 --> 00:00:19,110 We're going to see the ciphertext estar open the list multiplied by the year. 6 00:00:19,380 --> 00:00:25,860 Now, each string in the ciphertext Asgeir variable represents a column of the transpositions Saiful 7 00:00:25,860 --> 00:00:28,850 grid because number of column is equal to the key. 8 00:00:29,160 --> 00:00:36,000 You can use this replication to multiply a list with one blank string value in it by the by value in 9 00:00:36,000 --> 00:00:36,790 a particular key. 10 00:00:37,230 --> 00:00:39,360 So the string values will be assigned. 11 00:00:39,780 --> 00:00:46,350 All the characters that go into one column of the result will be the list of string value that represents 12 00:00:46,650 --> 00:00:48,740 each column as discussed earlier. 13 00:00:49,110 --> 00:00:55,200 Now, because the list indexes starts with zero, you will need to also label each column starting at 14 00:00:55,200 --> 00:00:55,680 zero. 15 00:00:56,370 --> 00:01:03,330 So you'll receive ciphertext zero or ciphertext Asgeir zero is the leftmost column and ciphertext ETR. 16 00:01:03,340 --> 00:01:07,950 One is the column to the right of that particular column and so on and so forth. 17 00:01:08,190 --> 00:01:14,220 So over here, the next step here will be adding the text to each string in the ciphertext. 18 00:01:14,220 --> 00:01:17,700 Asgeir as just did it as an example. 19 00:01:17,970 --> 00:01:22,170 Except this time we will add some code to make the computer do it programmatically. 20 00:01:22,410 --> 00:01:25,920 So here we are looping it through the foreach loop. 21 00:01:26,250 --> 00:01:32,310 So we are seeing four columnist here in the range of Gasteyer current ideas is equal to the columnist. 22 00:01:32,850 --> 00:01:39,510 So over here we are looping or iterating once for each column and the column variable has an integer 23 00:01:39,510 --> 00:01:45,450 value to use for the indexes to ciphertext Asgeir on the fourth iteration through the for loop. 24 00:01:45,660 --> 00:01:50,430 The column is still variable, set to zero on second set to one and so on. 25 00:01:50,790 --> 00:01:56,610 We have an index for the string values in the ciphertext Asgeir that we want to access later using the 26 00:01:56,610 --> 00:02:01,170 expression ciphertext Asgeir in the index of columnist. 27 00:02:01,890 --> 00:02:07,740 Now meanwhile, the current index variable who is the index of the message string for the program, 28 00:02:07,740 --> 00:02:15,030 looks at on each iteration for the loop, on each iteration the same or the current index of the same 29 00:02:15,030 --> 00:02:22,530 value as columnist and I will create a ciphertext ETR concatenating the scrambled the message together, 30 00:02:22,530 --> 00:02:29,700 one character at a time succumbing to the argument that assignment operator is not so far that we have 31 00:02:29,700 --> 00:02:32,070 concatenated or added values to each other. 32 00:02:32,070 --> 00:02:35,570 We have used plus operator to add a new value to the variable. 33 00:02:35,970 --> 00:02:41,580 Often when you're assigning a new value to a variable, you want it to be based on the variables current 34 00:02:41,580 --> 00:02:41,990 value. 35 00:02:42,240 --> 00:02:47,530 So you need to use variable as a part of the expression that is evaluated and assigned to a variable. 36 00:02:47,970 --> 00:02:54,780 For example, if you try to enter something in the interactive shell here like C span, that's equal 37 00:02:54,780 --> 00:03:05,220 to say 30 and here we say Hispanic will do span plus four and then we say put in the Valley of Spath, 38 00:03:05,570 --> 00:03:07,100 we get that thirty four printed. 39 00:03:07,560 --> 00:03:12,980 Now there are other ways to manipulate values in the variables based on the variables, current value. 40 00:03:13,320 --> 00:03:18,750 For example, you can do this by using the argument that assignment operators, the statement like for 41 00:03:18,750 --> 00:03:24,930 example, spane plus equal to two, which is used as plus equal to argument and assignment operator 42 00:03:25,170 --> 00:03:29,400 does the same thing as is equal to spend plus two, something like that. 43 00:03:29,400 --> 00:03:29,650 Right. 44 00:03:30,030 --> 00:03:32,330 So just a little shorter to type it. 45 00:03:32,550 --> 00:03:38,850 So the plus is equal to operator Volks with integers to do additions, strings to do string concatenation 46 00:03:38,940 --> 00:03:41,210 and less to do a list concatenation. 47 00:03:41,670 --> 00:03:47,310 So if we go back to our program here, they're more ten now over here. 48 00:03:47,520 --> 00:03:51,080 The value that this we have used to ciphertext Stia. 49 00:03:51,510 --> 00:03:58,410 So over here, the variable that is your current idea is basically holding the index of the next character 50 00:03:58,410 --> 00:03:59,420 in the message string. 51 00:03:59,790 --> 00:04:03,300 Now that will be concatenated to your ciphertext estar list. 52 00:04:03,900 --> 00:04:10,530 And the key added to the current index on each iterations will be to the point two different characters 53 00:04:10,530 --> 00:04:11,780 in the messages to you. 54 00:04:11,800 --> 00:04:16,710 And in each iterations, the current idea is set to the value and the columnist. 55 00:04:16,710 --> 00:04:20,520 You are variable to scramble the string in the message variable. 56 00:04:20,520 --> 00:04:26,520 We need to take the forced character of the message that is over here p and put it into the four string 57 00:04:26,520 --> 00:04:28,080 of the ciphertext STF. 58 00:04:28,350 --> 00:04:33,570 Then we will keep eight characters in the message because the key is equal to eight and concatenate 59 00:04:33,570 --> 00:04:39,540 the character that is after eight to do four string of the ciphertext estimate, we will continue to 60 00:04:39,540 --> 00:04:45,150 skip characters according to the key and concatenate each character until we reach the end of the message. 61 00:04:45,450 --> 00:04:49,380 Not doing so would create a particular string that we have forced us. 62 00:04:49,710 --> 00:04:56,250 We have getting there the value that this Sipi then if you just look at the excel that we have here 63 00:04:56,670 --> 00:04:59,430 and it's B always this default. 64 00:05:00,390 --> 00:05:06,420 The string that would be getting, which is the fourth column of the ciphertext year, then we would 65 00:05:06,420 --> 00:05:10,470 do this again, but started the second character in the message to make the second column. 66 00:05:10,950 --> 00:05:18,720 So inside the for loop that we have in our particular program available, that starts on the particular 67 00:05:18,720 --> 00:05:20,100 next line over here. 68 00:05:20,370 --> 00:05:26,130 It concatenated they write characters in the message to make each column and it loop wildly. 69 00:05:26,160 --> 00:05:32,100 Current idea is less than the length of the message now for each column, the how it reads through the 70 00:05:32,100 --> 00:05:37,860 original message variable and picks out the characters in the intervals of the key by adding to the 71 00:05:37,860 --> 00:05:38,580 current idea. 72 00:05:38,990 --> 00:05:46,960 OK, so after the break you have the message Estado all messages during the bracket in current IDEX 73 00:05:47,190 --> 00:05:52,890 is the false character of the message of the particular first iteration and the character at the message. 74 00:05:52,890 --> 00:06:00,720 Current IdeaCast is concatenated to the cipherText SDR column to start the first column in the next 75 00:06:00,720 --> 00:06:00,960 line. 76 00:06:01,440 --> 00:06:07,170 So in this way, the fourth time, the message zero second time with this message eight and third time 77 00:06:07,170 --> 00:06:09,600 with this message 16, four time with this message. 78 00:06:09,690 --> 00:06:10,280 Twenty four. 79 00:06:10,500 --> 00:06:13,550 That is how we get all the particular values concatenated. 80 00:06:13,770 --> 00:06:18,450 So although the value of the current idea is less than the length of string, but when you continue 81 00:06:18,450 --> 00:06:24,160 concatenating and the characters to the end of the string, add the column index is ciphertext Asgeir. 82 00:06:24,160 --> 00:06:28,230 When the current index is greater than the length of the message, execution will stop there. 83 00:06:28,620 --> 00:06:35,850 And because that isn't good indeed for block after the value, the loop or the for loop iterates column 84 00:06:35,850 --> 00:06:41,250 and sits at the one and the current index starts at the same value as the column. 85 00:06:41,700 --> 00:06:47,940 So over here we will get the values that we have got through the Manual V as we have created.