WEBVTT 0:00:02.860000 --> 0:00:07.340000 Hello and welcome this video titled Network Math, hexadecimal. 0:00:07.340000 --> 0:00:10.280000 In this video I'm going to teach you everything you ever want to know 0:00:10.280000 --> 0:00:11.620000 about hexadecimal. 0:00:11.620000 --> 0:00:14.740000 You're going to learn what hexadecimal numbers look like, how they actually 0:00:14.740000 --> 0:00:17.860000 incorporate letters as well as numbers, and you're going to learn how 0:00:17.860000 --> 0:00:21.940000 to convert from decimal into hexadecimal and back again. 0:00:21.940000 --> 0:00:24.980000 So let's learn hexadecimal the same way we learn binary. 0:00:24.980000 --> 0:00:28.980000 So once again starting with base 10, we don't have to recap that again. 0:00:28.980000 --> 0:00:30.780000 We know how base 10 works. 0:00:30.780000 --> 0:00:37.980000 Now decimal, base 10, hexadecimal, base 16. 0:00:37.980000 --> 0:00:41.900000 So somebody with a very cruel and twisted mind came up with this. 0:00:41.900000 --> 0:00:47.880000 So in base 16, we still have our ones position, but guess what? 0:00:47.880000 --> 0:00:52.280000 Now instead of multiplying by 10 or multiplying by 2 to get to the next 0:00:52.280000 --> 0:00:55.500000 slot, we multiply by 16. 0:00:55.500000 --> 0:00:57.660000 Now let me hold off here before I do that. 0:00:57.660000 --> 0:01:04.660000 So in base 10, this spot right here we had 10 digits we could choose from 0:01:04.660000 --> 0:01:08.820000 to put in that single spot, a 0 through a 9. 0:01:08.820000 --> 0:01:10.360000 Those were our 10 digits. 0:01:10.360000 --> 0:01:17.460000 So that means in base 16, in this spot right here, I have 16 digits I 0:01:17.460000 --> 0:01:18.620000 could choose from. 0:01:18.620000 --> 0:01:27.360000 What does that look like? 0:01:27.360000 --> 0:01:29.520000 That covers the first 10. 0:01:29.520000 --> 0:01:31.280000 Well, what about the last 6? 0:01:31.280000 --> 0:01:32.760000 What do those look like? 0:01:32.760000 --> 0:01:36.140000 At this point, we start using letters. 0:01:36.140000 --> 0:01:41.280000 So I could actually put into that spot right there the letter a or b, 0:01:41.280000 --> 0:01:48.700000 c, d, e, or f. And each one of those means something. 0:01:48.700000 --> 0:01:52.620000 So for example, if I have the letter a right here, that would convert 0:01:52.620000 --> 0:01:55.660000 back to decimal as the number 10. 0:01:55.660000 --> 0:02:03.400000 If I put a b in there, that would convert back to 11, c is 12, d is 13, 0:02:03.400000 --> 0:02:09.440000 e is 14, and f is 15. 0:02:09.440000 --> 0:02:13.120000 And that's as high as you can go in one slot. 0:02:13.120000 --> 0:02:20.360000 So those are our 16 characters that each placeholder could have 0 through 0:02:20.360000 --> 0:02:26.720000 f. Now, like I said, this is a base 16 counting system. 0:02:26.720000 --> 0:02:30.980000 So that means the next value is 16. 0:02:30.980000 --> 0:02:37.400000 And then to get the one after that, we take 16 times 16, which is 256. 0:02:37.400000 --> 0:02:39.120000 And we can keep going. 0:02:39.120000 --> 0:02:45.020000 256 times 16 is 4096. 0:02:45.020000 --> 0:02:50.900000 And this is one of the real power or benefits of using hexadecimal as 0:02:50.900000 --> 0:02:52.220000 a counting system. 0:02:52.220000 --> 0:02:56.940000 Because we can take a really large number and represent it with just a 0:02:56.940000 --> 0:03:06.680000 few digits. So for example, let's start out with something easy here. 0:03:06.680000 --> 0:03:13.460000 Let's say I gave you the number 5. 0:03:13.460000 --> 0:03:17.800000 And by the way, not always, but a lot of times, for example, if you see 0:03:17.800000 --> 0:03:25.720000 the number, let's say 1, 1, well, that could be a decimal, which would 0:03:25.720000 --> 0:03:29.740000 be 11. That could be binary. 0:03:29.740000 --> 0:03:32.460000 And with only two digits, that means the 1 bit and the 2 bit are turned 0:03:32.460000 --> 0:03:34.620000 on. So in binary, that would be 3. 0:03:34.620000 --> 0:03:37.940000 The 1 bit and the 2 bit are turned on. 0:03:37.940000 --> 0:03:41.060000 Or this could be a hexadecimal number. 0:03:41.060000 --> 0:03:42.620000 So how do you know? 0:03:42.620000 --> 0:03:48.100000 Well, not going to worry about binary, but in hexadecimal, a lot of times, 0:03:48.100000 --> 0:03:53.040000 hexadecimal numbers are preceded by 0x. 0:03:53.040000 --> 0:03:57.940000 So if you ever see a value that starts out with 0x and then something, 0:03:57.940000 --> 0:04:00.380000 that would mean you're looking at a hexadecimal value. 0:04:00.380000 --> 0:04:05.880000 So this right now would be 0x5, what I have right here. 0:04:05.880000 --> 0:04:10.760000 Well finally, I have a single digit, whether it be decimal, binary, or 0:04:10.760000 --> 0:04:14.040000 hexadecimal, they all mean the 1's position. 0:04:14.040000 --> 0:04:18.920000 So this is 5 times 1, which is 5. 0:04:18.920000 --> 0:04:21.540000 Now what if you saw this? 0:04:21.540000 --> 0:04:32.140000 0xc. Well right there, even without the 0x, you know that's hexadecimal. 0:04:32.140000 --> 0:04:35.720000 Because decimal doesn't have any letters in the counting system and binary 0:04:35.720000 --> 0:04:38.120000 doesn't have any letters in the counting system. 0:04:38.120000 --> 0:04:40.040000 That's got to be hexadecimal. 0:04:40.040000 --> 0:04:45.420000 And now you know that 0 through 9 are normal, so what's c? 0:04:45.420000 --> 0:04:52.420000 Well, we know that a is equal to 10, b is equal to 11, c is equal to 12. 0:04:52.420000 --> 0:04:59.320000 And because I only have one spot here, that's 12 times my 1's position. 0:04:59.320000 --> 0:05:02.000000 So that's the number 12 in decimal. 0:05:02.000000 --> 0:05:08.660000 So 0xc in hexadecimal is the same as 12 in decimal. 0:05:08.660000 --> 0:05:12.720000 What about, what if I put an f right here? 0:05:12.720000 --> 0:05:21.840000 0xf. Well, in my hexadecimal counting system, f was the highest number 0:05:21.840000 --> 0:05:30.440000 I could get to. Remember, we had 0 through 9, ab, c, d, e, and f. 0:05:30.440000 --> 0:05:36.860000 And f stood for 15. 0:05:36.860000 --> 0:05:43.200000 So if I have an f here, if I say 0xf, oops, sorry for my chicken scratch, 0:05:43.200000 --> 0:05:46.940000 let's do that again. 0:05:46.940000 --> 0:05:50.960000 0xf. Once again, this is the 1's position, because I've only got one digit. 0:05:50.960000 --> 0:05:57.140000 So that would be 15 times 1, which is the number 15. 0:05:57.140000 --> 0:06:05.620000 Now what if I have this 0x1a? 0:06:05.620000 --> 0:06:09.400000 Now I've got two values, right? 0:06:09.400000 --> 0:06:10.120000 Two bit positions. 0:06:10.120000 --> 0:06:16.880000 We know the first one is the 1's position, the next one is the 16's position. 0:06:16.880000 --> 0:06:20.480000 So the way you translate this is 1 times 16. 0:06:20.480000 --> 0:06:27.080000 I've got a single 16 plus a, which is 10. 0:06:27.080000 --> 0:06:32.180000 So let's put that down here in parentheses, a times 1. 0:06:32.180000 --> 0:06:40.620000 So that's 10 times 1. 0:06:40.620000 --> 0:06:47.300000 So 0x1a means I have a single value of 16 plus 10 values of 1. 0:06:47.300000 --> 0:06:51.160000 So 16 plus 10, 26. 0:06:51.160000 --> 0:06:53.440000 What if I gave you this? 0:06:53.440000 --> 0:07:02.340000 ab, 0xab. All right. 0:07:02.340000 --> 0:07:13.060000 That means in the 16's position, I have a times 16, and we know that a 0:07:13.060000 --> 0:07:27.220000 is 10. So that's 160 plus b times 1, and we know that b is 11. 0:07:27.220000 --> 0:07:28.380000 So that ends up being 11. 0:07:28.380000 --> 0:07:34.560000 So 160 plus 11, 171. 0:07:34.560000 --> 0:07:46.760000 So 0xab is 171. We have 10, 16's, so 16 times 10, plus 11 ones, because 0:07:46.760000 --> 0:07:50.540000 a is equal to 10, b is equal to 11. 0:07:50.540000 --> 0:07:53.740000 Let's just do one more. 0:07:53.740000 --> 0:08:05.640000 What if I had 0x21d? 0:08:05.640000 --> 0:08:10.100000 Pause the video for a second, see if you can figure that one out. 0:08:10.100000 --> 0:08:18.640000 Okay. So in this one, we've got three positions. 0:08:18.640000 --> 0:08:29.860000 So this right here is 2 times 256, because that's in my 256's position, 0:08:29.860000 --> 0:08:44.460000 which is 512, plus 1 times 16, which is just 16, plus. 0:08:44.460000 --> 0:08:54.100000 Now what was d? abcd, 10, 11, 12, 13. 0:08:54.100000 --> 0:09:03.640000 So d is 13. So we have 13 times 1, which is 13. 0:09:03.640000 --> 0:09:05.540000 So what does this give us? 0:09:05.540000 --> 0:09:21.000000 512 plus 16, which is 528, plus 13 is 538, 39, 40, 41, which is 541. 0:09:21.000000 --> 0:09:29.300000 So if I did my math correctly, 512 plus 16, 16, 26, 27, 28, that's 528, 0:09:29.300000 --> 0:09:32.800000 28, plus 13, 38, 39, 40, 41. 0:09:32.800000 --> 0:09:40.640000 So that's 541. So 0x21d is 541. 0:09:40.640000 --> 0:09:46.460000 Let me give you some and see if you can figure them out. 0:09:46.460000 --> 0:09:56.100000 How about 0x1e? Pause the video and press play when you think you've got 0:09:56.100000 --> 0:10:04.320000 the decimal equivalent of this. 0:10:04.320000 --> 0:10:16.220000 Okay, so in this case, we have 1 times 16, which is just 16, plus 14 times 0:10:16.220000 --> 0:10:28.620000 1, because it's 15. 0:10:28.620000 --> 0:10:31.040000 So 30 was the answer to that one. 0:10:31.040000 --> 0:10:33.440000 Let's do another one. 0:10:33.440000 --> 0:10:44.220000 0x13a. What's that? 0:10:44.220000 --> 0:10:52.500000 Pause the video for a moment and figure it out, then press play. 0:10:52.500000 --> 0:11:03.260000 Okay, so in this one, we have 1 times 256, because that third bit position, 0:11:03.260000 --> 0:11:12.980000 this is the 256 is, plus 3 times 16. 0:11:12.980000 --> 0:11:23.200000 So here we have 256 plus 48, plus a is 10. 0:11:23.200000 --> 0:11:29.240000 So 10 times 1, which is 10. 0:11:29.240000 --> 0:11:39.800000 So 256 plus 48. So 56 plus 48 is what? 0:11:39.800000 --> 0:11:43.200000 So 64. So that'd be 304. 0:11:43.200000 --> 0:11:51.100000 If I did my math correctly there, hopefully, 304 plus 10. 0:11:51.100000 --> 0:11:56.320000 So if I'm doing this in my head here, but I believe that is 314. 0:11:56.320000 --> 0:12:03.060000 Now just like with binary, let me now give you a decimal number and see 0:12:03.060000 --> 0:12:06.700000 if you can convert that into its hexadecimal equivalent. 0:12:06.700000 --> 0:12:09.400000 Let's start easy. 0:12:09.400000 --> 0:12:13.240000 How about the number 20? 0:12:13.240000 --> 0:12:20.060000 Pause the video and tell me what the hex equivalent is of 20. 0:12:20.060000 --> 0:12:35.440000 0x what? Well, with 20, we have 1 in the 16's position and 4 left over 0:12:35.440000 --> 0:12:37.820000 in the 1's position. 0:12:37.820000 --> 0:12:42.540000 So 0x14, a single 16 plus 4 1's. 0:12:42.540000 --> 0:12:44.920000 Let's do two more. 0:12:44.920000 --> 0:12:52.600000 How about the number 100 in decimal? 0:12:52.600000 --> 0:12:56.360000 What is that in hexadecimal? 0:12:56.360000 --> 0:12:59.900000 Pause the video and press play when you think you have the solution. 0:12:59.900000 --> 0:13:07.700000 Okay, so let's figure this one out. 0:13:07.700000 --> 0:13:09.600000 This is a little bit tougher. 0:13:09.600000 --> 0:13:11.120000 So I have to count this on my fingers. 0:13:11.120000 --> 0:13:13.840000 I know it's not going to be three digits because we're not up into the 0:13:13.840000 --> 0:13:17.760000 256's, so it's going to be only a two digit number. 0:13:17.760000 --> 0:13:21.800000 So it's going to be some value or multiple or increment of 16. 0:13:21.800000 --> 0:13:25.620000 So how many multiples of 16's do I need to have to fit into 100? 0:13:25.620000 --> 0:13:41.080000 Well, I've got 16, 32, 48, 64, 80, 96, and that's as close as I can get. 0:13:41.080000 --> 0:13:49.260000 So six instances of 16 gives me 96 plus 4 left over. 0:13:49.260000 --> 0:13:56.140000 So 0x64, if I've done my math correctly, will be 100 in decimal. 0:13:56.140000 --> 0:14:01.660000 And just like I did with binary, where would we see these in actual networking 0:14:01.660000 --> 0:14:05.500000 commands? Well, here's three examples of this. 0:14:05.500000 --> 0:14:10.260000 In the world of IP version 6, which if you don't know it, you will need 0:14:10.260000 --> 0:14:15.640000 to learn it for networking purposes, IP version 6 addresses are entered 0:14:15.640000 --> 0:14:17.340000 as hexadecimal values. 0:14:17.340000 --> 0:14:19.520000 Clearly you can see this one's got letters in it. 0:14:19.520000 --> 0:14:23.580000 And every time you see letters, you just think, ah, hexadecimal. 0:14:23.580000 --> 0:14:27.960000 Cisco routers and switches have something called a configuration register, 0:14:27.960000 --> 0:14:32.060000 which dictates how that device will act when it first powers on or boots 0:14:32.060000 --> 0:14:42.460000 up. That is represented as a hexadecimal value. 0:14:42.460000 --> 0:14:45.860000 Switches have something called MAC address tables, where they store MAC 0:14:45.860000 --> 0:14:48.620000 addresses of the devices that they've connected to. 0:14:48.620000 --> 0:14:53.780000 MAC addresses on switches and on your laptop per PC are represented as 0:14:53.780000 --> 0:14:55.960000 hexadecimal values. 0:14:55.960000 --> 0:14:59.060000 And so you can see an example of that right there. 0:14:59.060000 --> 0:15:00.360000 So thank you for watching. 0:15:00.360000 --> 0:15:03.460000 That concludes this video on network math.