1 00:00:00,180 --> 00:00:07,500 Welcome to the next session in our Python hacking code that is hacking the seasonal cipher, using the 2 00:00:07,530 --> 00:00:08,290 brute force. 3 00:00:08,790 --> 00:00:15,360 Now we can hack this is a cipher by using a another technique, which is called brute force. 4 00:00:15,510 --> 00:00:20,490 A brute force attack tries every possible decryption key for a particular cipher. 5 00:00:20,940 --> 00:00:27,420 Nothing can stop a cryptanalysis from getting one, decrypting the ciphertext with that key, looking 6 00:00:27,420 --> 00:00:28,250 at the output. 7 00:00:28,410 --> 00:00:35,340 And then we want to the next key, if they didn't find the secret message now because the brute force 8 00:00:35,340 --> 00:00:41,340 technique is so effective against Caesar Saiful, you shouldn't actually use a Caesar cipher to encrypt 9 00:00:41,340 --> 00:00:42,570 secret information. 10 00:00:42,690 --> 00:00:48,250 Now coming to a new file, which we will be creating for this particular demonstration. 11 00:00:48,600 --> 00:00:52,650 So let us go to our potential and create a new file here. 12 00:00:53,070 --> 00:00:58,530 And first thing is, we will type our hacker code over here for Caesar Saiful. 13 00:00:58,920 --> 00:01:07,310 So now you let us create first same message SDR and we'll give here the text in a decrypted format, 14 00:01:07,320 --> 00:01:07,630 OK? 15 00:01:08,100 --> 00:01:14,190 So we'll use a single code and we'll give you some text in a decrypted format. 16 00:01:15,360 --> 00:01:16,770 See six. 17 00:01:17,970 --> 00:01:22,350 She said exclamation g six. 18 00:01:24,060 --> 00:01:30,540 Now this is all in encrypted format that we are typing just to see the output that we get. 19 00:01:32,770 --> 00:01:41,050 Similarly, we would use your symbols as and we'll save you all the capital letters cost 20 00:01:47,560 --> 00:01:51,700 X, Y, Z, similarly will store everything in this mall. 21 00:01:59,410 --> 00:02:09,030 OK, and after that, we will store also the new Marika's a space exclamation mark, a question mark 22 00:02:09,030 --> 00:02:16,230 or dot everything in the symbol that we have written, the symbol Asgeir in the capital, because we 23 00:02:16,230 --> 00:02:21,270 want to make sure that this is what we basically we are creating as a constant, which will not have 24 00:02:21,270 --> 00:02:23,080 the values changed frequently. 25 00:02:23,250 --> 00:02:26,970 OK, then we will look through the every possible key. 26 00:02:27,330 --> 00:02:33,450 So over here we will run for loop things for key estie are in. 27 00:02:34,500 --> 00:02:44,500 Range rockets will give the length of symbols start over here and will open the for loop and inside 28 00:02:44,500 --> 00:02:51,690 of this for loop, we will basically set a variable to blankest drawstring so that the previous iteration 29 00:02:51,690 --> 00:02:54,420 values for the particular text is clear. 30 00:02:54,810 --> 00:02:55,650 So we'll see. 31 00:02:56,100 --> 00:03:01,350 Translated SDR is equal to like OK now. 32 00:03:02,410 --> 00:03:07,600 The Restoril down below would be same as almost same as I will see the Saiful program that we had done 33 00:03:07,840 --> 00:03:09,160 in the last session. 34 00:03:09,460 --> 00:03:12,790 So over here, we look to each symbol in the particular message. 35 00:03:13,090 --> 00:03:18,430 So for that, we will run for loop again, say for a swim in. 36 00:03:19,800 --> 00:03:29,190 Message SDR, open the loop, then inside this, we check if the value of X, y, m in. 37 00:03:30,760 --> 00:03:38,470 Symbols are OK, then you see one more variable symbol index or this y m. 38 00:03:39,840 --> 00:03:50,820 Index, which is equal to we see Symbolistic, Dot, find the value of X, Y, and then we say the. 39 00:03:53,080 --> 00:04:05,320 Translated, that is equal to our SVM index, minus the value of now here we would be taking the value 40 00:04:05,320 --> 00:04:11,250 for ATSDR and then we will handle the wrap around here below. 41 00:04:11,320 --> 00:04:24,640 We would say if our C translated into X, if it is less than zero colon, then we c c translated it 42 00:04:25,150 --> 00:04:30,910 is equal to translated into X plus the length of. 43 00:04:33,430 --> 00:04:34,300 Symbolistic. 44 00:04:35,460 --> 00:04:42,710 OK, after that, we would open the decryption module, so we'll go one level back and he'll receive 45 00:04:42,870 --> 00:04:52,290 the translated SDR is equal to what is the initial value when translated SDR, plus adding that the 46 00:04:52,290 --> 00:05:02,190 value of SYMBOLISTIC index of translated ideas like that is the index key that we would be taking for 47 00:05:02,190 --> 00:05:05,640 adding one one value in the translated queue. 48 00:05:06,090 --> 00:05:14,910 Now after this we would go for the upper F condition is so we'll go here for LS column and here we would 49 00:05:14,910 --> 00:05:16,230 write down the value of. 50 00:05:17,310 --> 00:05:19,680 Translated SDR is equal to. 51 00:05:21,520 --> 00:05:32,320 Translated Astar Plus, I am OK, and now for display every possible description text, let's go one 52 00:05:32,320 --> 00:05:40,240 level back and we'll come for the melody for and over here we will give up and come on see Saiki. 53 00:05:42,190 --> 00:05:49,390 Value give you a little hash, then we give you a percent is golden. 54 00:05:50,370 --> 00:05:57,780 Bosomed is the single quotation marks we would print the value of yesteryear and the value of. 55 00:05:59,370 --> 00:06:07,090 Translated SDM, OK, now let us see if this would save it in Python Hacking Beginner. 56 00:06:07,560 --> 00:06:12,530 Now let's give you the demo age, OK? 57 00:06:13,440 --> 00:06:16,680 And save it now to run this. 58 00:06:17,740 --> 00:06:23,620 Will go for unmodern and over here at one point of time, you would see. 59 00:06:24,980 --> 00:06:32,650 We are getting this particular fixed in a normal English code because we have given this as the key 60 00:06:32,660 --> 00:06:39,620 core thing where we had decrypted that using the particular key, you here will also find out what good 61 00:06:39,650 --> 00:06:40,520 we have used. 62 00:06:40,850 --> 00:06:47,000 OK, now one important thing over here, what mistake we we must have made is over here inside the message. 63 00:06:47,360 --> 00:06:50,330 Let us check the encrypted message that we have written. 64 00:06:50,480 --> 00:07:03,260 It is G.V. then we have six juvy, then it is six GZ in here, or we don't have this exclamation mark 65 00:07:03,260 --> 00:07:03,770 also. 66 00:07:04,790 --> 00:07:18,050 Whereas after 60 we have you say F Arpit, then five or seven and we have G now here we have this capitals 67 00:07:18,050 --> 00:07:23,730 that are that is six to six and this also is not so. 68 00:07:23,750 --> 00:07:28,430 Now let us save this and let's try to run the Modu. 69 00:07:28,880 --> 00:07:33,190 So now if you check out at number 13, we get the value. 70 00:07:33,590 --> 00:07:36,050 This is a secret message. 71 00:07:36,440 --> 00:07:39,380 OK, again, here, let us just check once. 72 00:07:40,410 --> 00:07:45,820 OK, Chris, let us open our scissors for program, and here we have written. 73 00:07:45,840 --> 00:07:46,980 This is my secret message. 74 00:07:46,990 --> 00:07:48,240 We want to encrypted this. 75 00:07:48,510 --> 00:07:51,400 So now let us check the output for this program. 76 00:07:51,930 --> 00:07:53,620 OK, now this is the encryption key. 77 00:07:53,880 --> 00:07:55,470 So now let's copy this. 78 00:07:56,220 --> 00:07:57,390 Let's close this. 79 00:07:58,110 --> 00:08:02,360 And here let's cooperate on the same encrypted text, OK? 80 00:08:02,400 --> 00:08:04,450 And now let's try to run the module. 81 00:08:04,980 --> 00:08:07,220 Now let's check on number 13. 82 00:08:07,920 --> 00:08:09,900 OK, some mistake again. 83 00:08:10,260 --> 00:08:12,120 And that mistake is over here. 84 00:08:12,270 --> 00:08:13,050 It does not. 85 00:08:13,050 --> 00:08:14,790 And then it is an. 86 00:08:15,900 --> 00:08:19,880 OK, let's save this and run it again now. 87 00:08:21,510 --> 00:08:29,340 Yes, so now you can find out what is the original message and which key was used to encrypt this particular 88 00:08:29,340 --> 00:08:29,910 message. 89 00:08:29,940 --> 00:08:33,700 OK, now let us understand the code that we have written. 90 00:08:33,750 --> 00:08:37,890 OK, now, for years, we have seen how the output is coming. 91 00:08:38,080 --> 00:08:45,000 OK, so we are getting the output in a decrypted format on the key today, which is coming in a plain 92 00:08:45,000 --> 00:08:45,840 English text. 93 00:08:46,560 --> 00:08:50,220 So now we can know that the original encryption key must have been 30. 94 00:08:50,400 --> 00:08:50,760 Right. 95 00:08:51,120 --> 00:08:55,670 So with this now, let us understand the code that we have written. 96 00:08:55,680 --> 00:08:57,390 So let's go back to the code here. 97 00:08:57,620 --> 00:08:57,980 OK. 98 00:08:58,900 --> 00:09:05,500 Now, here, the program we are creating, this message, which is basically storing the ciphertext, 99 00:09:05,770 --> 00:09:09,520 was a string in the program that is trying to decrypt. 100 00:09:10,270 --> 00:09:16,660 Similarly, the next is we are having the symbols, which is a constant variable containing every character 101 00:09:16,660 --> 00:09:18,300 that decipher can encrypt. 102 00:09:18,580 --> 00:09:22,090 So it will be from capitals, smores, even the numbers. 103 00:09:22,150 --> 00:09:28,360 OK, now this value in the symbols of a state that we have given needs to be the same as the value for 104 00:09:28,660 --> 00:09:31,900 the symbol as you have used in the C the cipher program. 105 00:09:32,530 --> 00:09:36,930 Otherwise you will not get the hacker program, will not work properly. 106 00:09:37,120 --> 00:09:43,570 Even know that with the space between zero, exclamation mark has to be there, as you have written 107 00:09:43,570 --> 00:09:44,080 in the same. 108 00:09:44,350 --> 00:09:45,730 So see the cipher program. 109 00:09:46,250 --> 00:09:51,440 Right now let's come to the next part where we go for looping with the range function. 110 00:09:51,730 --> 00:10:00,010 So over here we basically doesn't want to string value, but instead we attribute the return value from 111 00:10:00,010 --> 00:10:01,880 the call to the range function. 112 00:10:02,230 --> 00:10:08,380 So the range function here takes integer arguments and returns a value of the range data. 113 00:10:08,410 --> 00:10:14,890 Right now, the range values can be used in four loops to loop of specific number of times, according 114 00:10:14,890 --> 00:10:17,200 to the integer you give in the function. 115 00:10:17,560 --> 00:10:22,050 Now let us try some example of this range in the interactive. 116 00:10:22,630 --> 00:10:33,800 So let's go here and we will write down here, for example, for I1 in range C for Colon. 117 00:10:34,060 --> 00:10:40,740 And here we give C print in bracket C fighting, hacking. 118 00:10:41,800 --> 00:10:47,410 OK, so four times we're getting the string python hacking print. 119 00:10:47,980 --> 00:10:55,030 So you'll be for a loop the loop for four times because we have the integer four in the reach. 120 00:10:55,180 --> 00:11:01,840 So more specifically the range value return from the range function called reset the loop or the four 121 00:11:01,840 --> 00:11:07,290 loops variable to integers from zero to the argument that is passed in the range. 122 00:11:07,300 --> 00:11:10,710 So for example, here we are having from zero to four. 123 00:11:10,900 --> 00:11:18,100 OK, so more specifically, if you want to know how the arguments are passed onto the program, that 124 00:11:18,130 --> 00:11:19,480 you can try it out over here. 125 00:11:19,480 --> 00:11:22,600 This is for Ivan in range. 126 00:11:22,900 --> 00:11:24,290 We give you say seven. 127 00:11:24,830 --> 00:11:29,590 OK, and now we try to put it in brackets, the value of Ivan. 128 00:11:29,890 --> 00:11:37,270 OK, now let's see how this it is going from zero six because we are giving their range in bracket seven. 129 00:11:37,600 --> 00:11:37,990 Right. 130 00:11:38,110 --> 00:11:44,500 So over here because that's the variable even to the value from zero, but not including seven, which 131 00:11:44,500 --> 00:11:46,760 is similar to what we have in the Olelbis.