1 00:00:00,009 --> 00:00:02,109 Welcome to the next mini project. 2 00:00:02,119 --> 00:00:02,829 And over here, 3 00:00:02,839 --> 00:00:07,280 we're gonna build ourselves a tool for encrypting and decrypting files. 4 00:00:07,420 --> 00:00:11,470 Now, the way it works is that once the user has run the program, 5 00:00:11,479 --> 00:00:13,680 they will be provided with four different options. 6 00:00:13,689 --> 00:00:14,989 You can see on your screen, 7 00:00:15,350 --> 00:00:18,459 they can either generate an encryption key, encrypt, the file, 8 00:00:18,469 --> 00:00:21,149 decrypt the file or simply just exit the program. 9 00:00:21,340 --> 00:00:25,750 So if I go with option number one right here to generate an encryption key, 10 00:00:26,180 --> 00:00:30,799 now you can see that we're gonna be prompted with the question, 11 00:00:31,129 --> 00:00:33,580 enter the file path to save the key. 12 00:00:33,689 --> 00:00:39,040 Now, the point of this is that we're actually going to provide the user the ability 13 00:00:39,419 --> 00:00:44,900 to either use the default key that we ourselves are gonna create or 14 00:00:45,069 --> 00:00:47,750 they could use their own custom key. 15 00:00:47,759 --> 00:00:50,520 That's the whole point of this question or prompt, 16 00:00:50,529 --> 00:00:52,549 asking the user to provide the file path. 17 00:00:52,909 --> 00:00:55,319 So if the user decides to go with the default key, 18 00:00:55,330 --> 00:00:56,930 so I'm going to press enter right now. 19 00:00:57,259 --> 00:01:00,860 Now you will see that we've created a file over here called encryption 20 00:01:00,869 --> 00:01:07,349 on the score key key that now has a particular key for encryption 21 00:01:07,610 --> 00:01:12,690 So now if I was to go back to the program and I typed option number two to encrypt a file, 22 00:01:13,339 --> 00:01:15,279 I have created a sample 23 00:01:15,660 --> 00:01:15,699 XI 24 00:01:15,819 --> 00:01:17,930 file in here with some random text. 25 00:01:18,339 --> 00:01:22,959 So let's say for example, we wanted to encrypt this file. Now 26 00:01:23,120 --> 00:01:25,349 I'm going to provide the name of the file, sample dot 27 00:01:25,470 --> 00:01:25,980 txt 28 00:01:26,620 --> 00:01:27,650 press enter. 29 00:01:27,879 --> 00:01:31,760 And now we can provide a name for the output file. 30 00:01:31,930 --> 00:01:37,790 So we can call this one encrypted underscore file dot TXT. OK? 31 00:01:37,970 --> 00:01:39,319 And now we press enter 32 00:01:39,910 --> 00:01:43,699 and now we can enter the path of the encryption key to be used 33 00:01:43,849 --> 00:01:46,830 again. We're gonna go with the default key. So I'll press enter 34 00:01:47,260 --> 00:01:50,059 and now our file has been encrypted 35 00:01:50,260 --> 00:01:54,309 and has been saved to another file called encrypted underscore file dot TXT. 36 00:01:54,500 --> 00:01:56,760 You can see this is the file right here. So 37 00:01:57,260 --> 00:01:59,559 if I open it up right now, 38 00:01:59,569 --> 00:02:04,839 you can see that this is the encrypted version of our sample dot txt file. 39 00:02:05,120 --> 00:02:10,110 Now, if I go back and go with option number three to decrypt a file, 40 00:02:10,369 --> 00:02:12,770 OK? And now let us decrypt 41 00:02:12,880 --> 00:02:15,210 the file that we just encrypted. 42 00:02:15,509 --> 00:02:16,929 OK. So 43 00:02:17,199 --> 00:02:18,850 I'm gonna go encrypted 44 00:02:19,880 --> 00:02:22,190 underscore file dot TXT. 45 00:02:22,199 --> 00:02:26,960 This is the file that we just, this is the newly encrypted file. So now I press enter 46 00:02:27,080 --> 00:02:31,860 and now what's the name of the upload file? We can see decrypted underscore file 47 00:02:32,100 --> 00:02:37,149 dot TXT. We press enter and then we press enter again to use the default key. 48 00:02:37,289 --> 00:02:40,399 And now we have decrypted the file and send it 49 00:02:40,410 --> 00:02:42,860 to a new file called decrypted underscore file dot TXT. 50 00:02:42,869 --> 00:02:44,309 And if I open it right here 51 00:02:44,460 --> 00:02:48,820 now, you can see we have gotten the exact same text back again. 52 00:02:49,080 --> 00:02:51,779 So basically the, the way the program works is that we're gonna provide 53 00:02:52,449 --> 00:02:52,460 a 54 00:02:52,570 --> 00:02:55,789 file in this case right now, it is going to be sampled dot TXT. 55 00:02:55,880 --> 00:02:59,539 We're going to encrypt it using the encryption key that we've generated. 56 00:02:59,750 --> 00:03:02,009 We're gonna store it to a file called encrypted 57 00:03:02,270 --> 00:03:03,360 uncore file dot TXT. 58 00:03:03,600 --> 00:03:05,070 And then we're going to attempt to decrypt 59 00:03:05,080 --> 00:03:07,080 the file and then save the contents to decrypted 60 00:03:07,220 --> 00:03:07,270 domos 61 00:03:07,440 --> 00:03:11,289 file dot XT. And as you can see right now, it works perfectly well. So 62 00:03:11,410 --> 00:03:15,339 I'm gonna show you exactly how we can build out this particular kind of tool. 63 00:03:15,589 --> 00:03:16,619 I'm going to divide 64 00:03:16,729 --> 00:03:19,240 the entire project into three different topics. 65 00:03:19,250 --> 00:03:22,000 So the first one, we're going to create an encryption key. 66 00:03:22,139 --> 00:03:23,139 And then the second video, 67 00:03:23,149 --> 00:03:27,350 we're going to create both the encryption and decryption keys, the functions. 68 00:03:27,470 --> 00:03:31,600 And then finally, in task number three, we will add the user interface. 69 00:03:31,610 --> 00:03:33,630 So don't waste any more time. Let's get started.