1 00:00:06,270 --> 00:00:08,160 - Let's go over what are hashing algorithms. 2 00:00:08,160 --> 00:00:11,370 And before we do that, let's see what is actually hashing. 3 00:00:11,370 --> 00:00:15,830 So hashing is a method used to verify data integrity, right? 4 00:00:15,830 --> 00:00:19,300 That means that you can verify the integrity of a file. 5 00:00:19,300 --> 00:00:21,000 You can verify the integrity of 6 00:00:21,869 --> 00:00:23,760 data being exchanged between two entities, 7 00:00:23,760 --> 00:00:25,720 or you can verify the integrity 8 00:00:25,720 --> 00:00:28,410 of a process or a program, right? 9 00:00:28,410 --> 00:00:31,600 A cryptographic hash function is a process 10 00:00:31,600 --> 00:00:34,150 that actually takes a block of data. 11 00:00:34,150 --> 00:00:37,830 And then it creates a small fixed size hash values, right? 12 00:00:37,830 --> 00:00:39,290 It's a one way function. 13 00:00:39,290 --> 00:00:40,480 That means that actually 14 00:00:40,480 --> 00:00:43,680 if two different computers take the same data 15 00:00:43,680 --> 00:00:45,374 and run the same hash function 16 00:00:45,374 --> 00:00:49,980 they should get the same fixed size hash value. 17 00:00:49,980 --> 00:00:52,730 For example, you know, perhaps a 12 bit long hash 18 00:00:52,730 --> 00:00:55,720 and I'll demo this in a few minutes. 19 00:00:55,720 --> 00:00:58,640 Now, examples of hashing algorithms are 20 00:00:58,640 --> 00:01:01,540 the Message digest 5 or MD5 21 00:01:01,540 --> 00:01:04,340 which actually creates 128 bit digest. 22 00:01:04,340 --> 00:01:05,814 And it's actually less secure 23 00:01:05,814 --> 00:01:10,770 than the ones below the secure hash algorithm or SHA-1. 24 00:01:10,770 --> 00:01:13,150 It actually creates 160 bit digest. 25 00:01:13,150 --> 00:01:17,270 And then the more secure is the second version of that 26 00:01:17,270 --> 00:01:20,796 which is a secure hash algorithm or SHA version two 27 00:01:20,796 --> 00:01:25,796 which actually include digest between 224 bits and 512 bits. 28 00:01:26,544 --> 00:01:29,570 So in this example, I actually have three files, right? 29 00:01:29,570 --> 00:01:33,110 File one, file two, and file three. 30 00:01:33,110 --> 00:01:35,330 And as a matter of fact, if you actually see, you know 31 00:01:35,330 --> 00:01:40,330 file one in this case actually has the same bites. 32 00:01:41,400 --> 00:01:43,030 That's five, three. 33 00:01:43,030 --> 00:01:45,500 So it's 32 of the sites. 34 00:01:45,500 --> 00:01:47,225 And as a matter of fact. 35 00:01:47,225 --> 00:01:52,057 If we do a LS minus H to do a human oops LS minus L and H 36 00:01:53,030 --> 00:01:54,840 you can see actually 32 bites 37 00:01:54,840 --> 00:01:58,730 in each and then file two has 288 bites. 38 00:01:58,730 --> 00:02:00,280 If we actually look at each of the files. 39 00:02:00,280 --> 00:02:03,005 So let's look at file one, for example 40 00:02:03,005 --> 00:02:06,380 the file context is, you know, is just self explanatory. 41 00:02:06,380 --> 00:02:08,466 This is the contents of the file. 42 00:02:08,466 --> 00:02:09,299 That's what is actually in that file. 43 00:02:09,299 --> 00:02:12,900 If you look at file two, the contents of the file 44 00:02:12,900 --> 00:02:14,870 this is actually this and you, if you see 45 00:02:14,870 --> 00:02:16,910 there's actually more data subsequently 46 00:02:16,910 --> 00:02:19,610 you see the number of bites actually increase. 47 00:02:19,610 --> 00:02:21,850 Now, this is the particular fashioning here. 48 00:02:21,850 --> 00:02:24,670 File three is name file three. 49 00:02:24,670 --> 00:02:27,223 However, if I open that file, 50 00:02:27,223 --> 00:02:29,270 you will see that the content 51 00:02:29,270 --> 00:02:31,410 is exactly the same as file one. 52 00:02:31,410 --> 00:02:33,960 As a matter of fact, what I did before is demo is 53 00:02:33,960 --> 00:02:36,840 I actually copy file one to file three. 54 00:02:36,840 --> 00:02:39,330 Now let's actually take a look at the actual hashing, right? 55 00:02:39,330 --> 00:02:42,151 So how to verify the integrity of those files 56 00:02:42,151 --> 00:02:45,410 and you can actually have most operating system 57 00:02:45,410 --> 00:02:47,970 actually support a hashing verification. 58 00:02:47,970 --> 00:02:50,760 In this case, I'm actually running on the Mac OSS device. 59 00:02:50,760 --> 00:02:53,390 This is very similar to a Linux environment as well. 60 00:02:53,390 --> 00:02:57,570 And there's a shasum utility, right? 61 00:02:57,570 --> 00:02:59,130 That you can actually use. 62 00:02:59,130 --> 00:02:59,963 And so matter of fact 63 00:02:59,963 --> 00:03:02,100 I'm actually just gonna do the help in here. 64 00:03:02,100 --> 00:03:05,670 And basically it prints or checks 65 00:03:05,670 --> 00:03:09,690 the check sums of a file or, you know, a binary. 66 00:03:09,690 --> 00:03:10,610 And in this case 67 00:03:10,610 --> 00:03:15,610 I'm actually gonna use the 512 option of a SHA-2. 68 00:03:16,197 --> 00:03:18,760 So let's do this real quick 69 00:03:18,760 --> 00:03:23,760 shasum minus A for algorithm, and then 512 70 00:03:24,600 --> 00:03:26,840 I'm gonna do it through all the files in these directories. 71 00:03:26,840 --> 00:03:28,590 So doing a wild card 72 00:03:28,590 --> 00:03:32,790 and here you actually see the different hashes 73 00:03:32,790 --> 00:03:33,760 for each of the files. 74 00:03:33,760 --> 00:03:36,030 So if you look at, remember that the contents 75 00:03:36,030 --> 00:03:38,780 of file one and file three were the same. 76 00:03:38,780 --> 00:03:43,510 You actually see that the shasum calculated 77 00:03:43,510 --> 00:03:47,730 or the hash sum calculated that is actually done in here. 78 00:03:47,730 --> 00:03:50,170 And hexadecimal code in here 79 00:03:51,953 --> 00:03:53,070 is exactly the same as file three, right? 80 00:03:53,070 --> 00:03:54,930 So again, file two was actually different 81 00:03:54,930 --> 00:03:57,480 and subsequently you actually see it as a different 82 00:03:58,730 --> 00:03:59,820 a different output here. 83 00:03:59,820 --> 00:04:03,649 So this is actually very important to know 84 00:04:03,649 --> 00:04:06,470 especially whenever you're actually doing file integrity 85 00:04:06,470 --> 00:04:08,660 and file verification and, you know, 86 00:04:08,660 --> 00:04:12,807 any other type of verification using hashing algorithms. 87 00:04:12,807 --> 00:04:14,640 And here, actually, I want to summarize 88 00:04:14,640 --> 00:04:16,310 what you learned in the, in this lesson 89 00:04:16,310 --> 00:04:17,480 and in the previous lesson, right? 90 00:04:17,480 --> 00:04:20,990 So encryption algorithms and hashing algorithms 91 00:04:20,990 --> 00:04:22,510 and what they're actually used for, right. 92 00:04:22,510 --> 00:04:24,570 So first starting from the left 93 00:04:24,570 --> 00:04:27,097 and the top left symmetrical encryption algorithms 94 00:04:27,097 --> 00:04:29,680 remember that they actually use the same key 95 00:04:29,680 --> 00:04:31,510 for encrypting and decrypting data. 96 00:04:31,510 --> 00:04:34,053 And these are some of the examples of those algorithms. 97 00:04:34,053 --> 00:04:37,376 Then you have asymmetrical encryption algorithms 98 00:04:37,376 --> 00:04:40,380 which use a public or private key, right? 99 00:04:40,380 --> 00:04:43,480 So one key to encrypt data and another one actually used 100 00:04:43,480 --> 00:04:48,040 to decrypt and some examples of those algorithms. 101 00:04:48,040 --> 00:04:50,960 Then we actually cover as well, digital signatures, right? 102 00:04:50,960 --> 00:04:53,930 So this is actually done for the encryption 103 00:04:53,930 --> 00:04:57,640 of a hash using a private key, and then the decryption 104 00:04:57,640 --> 00:05:00,610 of a hash using the senders public key. 105 00:05:00,610 --> 00:05:04,182 As we actually saw in the previous examples of PGP, right? 106 00:05:04,182 --> 00:05:07,311 Also you have the Diffie-Helman Key Exchange. 107 00:05:07,311 --> 00:05:10,622 And you know, of course the examples using IP sec 108 00:05:10,622 --> 00:05:15,622 and encryption algorithms and hashing algorithms using 109 00:05:15,660 --> 00:05:19,110 use for confidentiality, integrity 110 00:05:19,110 --> 00:05:20,690 and authentication, right? 111 00:05:20,690 --> 00:05:23,100 So here, you know, self explanatory, 112 00:05:23,100 --> 00:05:25,240 some encryption algorithms that provide 113 00:05:25,240 --> 00:05:27,686 converting clear text to cipher texts, 114 00:05:27,686 --> 00:05:30,624 increase the ability for you to actually 115 00:05:30,624 --> 00:05:34,320 protect the confidentiality of you know, 116 00:05:34,320 --> 00:05:36,030 transactions and files. 117 00:05:36,030 --> 00:05:37,330 And these are some of the examples 118 00:05:37,330 --> 00:05:39,910 of the encryption algorithms to do that. 119 00:05:39,910 --> 00:05:42,666 And then for data integrity or for file integrity 120 00:05:42,666 --> 00:05:46,180 which validates the data by compared hash values 121 00:05:46,180 --> 00:05:48,880 just like we saw in the demo 122 00:05:48,880 --> 00:05:51,820 these are the algorithms that actually are supported. 123 00:05:51,820 --> 00:05:54,100 And then of course you actually have algorithms 124 00:05:54,100 --> 00:05:58,143 for authentication and to verify the peers identity.