1
00:00:00.05 --> 00:00:02.05
- [Instructor] The concept
of hashing is critical

2
00:00:02.05 --> 00:00:05.02
to many applications
within computer science

3
00:00:05.02 --> 00:00:08.05
and the cryptography area is no different.

4
00:00:08.05 --> 00:00:09.04
In cryptography,

5
00:00:09.04 --> 00:00:13.08
we focus on cryptographically
strong hash algorithms.

6
00:00:13.08 --> 00:00:16.05
What is a cryptographic hash, you may ask?

7
00:00:16.05 --> 00:00:18.05
Essentially, it's the
same as any other hash

8
00:00:18.05 --> 00:00:21.06
with a little bit more detail involved.

9
00:00:21.06 --> 00:00:24.06
It's a hash function that
takes an arbitrary input

10
00:00:24.06 --> 00:00:27.04
and produces a fixed-sized output.

11
00:00:27.04 --> 00:00:29.03
That's one of the key differences

12
00:00:29.03 --> 00:00:32.02
is that fixed-sized output.

13
00:00:32.02 --> 00:00:36.02
A cryptographic hash should
also be easy to calculate.

14
00:00:36.02 --> 00:00:40.06
However, it should be very
difficult if not impossible

15
00:00:40.06 --> 00:00:44.05
to find the original input
that yielded that output

16
00:00:44.05 --> 00:00:47.02
that was so easy to calculate.

17
00:00:47.02 --> 00:00:50.06
It also should be very
difficult if not impossible

18
00:00:50.06 --> 00:00:55.02
to duplicate with multiple unique inputs.

19
00:00:55.02 --> 00:00:58.07
A cryptographic hash is also
known by several other terms

20
00:00:58.07 --> 00:01:01.06
and I wanna talk about 'em
briefly just in case you see them

21
00:01:01.06 --> 00:01:03.03
throughout the literature.

22
00:01:03.03 --> 00:01:05.08
These terms are things
like digital fingerprint,

23
00:01:05.08 --> 00:01:08.05
or digest, or message digest,

24
00:01:08.05 --> 00:01:12.00
which is how we'll actually
see it referenced in the JCA.

25
00:01:12.00 --> 00:01:14.05
Finally is checksum
which you may have seen

26
00:01:14.05 --> 00:01:17.02
when you've downloaded files
throughout the internet.

27
00:01:17.02 --> 00:01:20.06
You may see an NV5 checksum of that binary

28
00:01:20.06 --> 00:01:23.06
so that you can ensure
that it is the exact size

29
00:01:23.06 --> 00:01:28.01
and the exact binary content
that the producer created.

30
00:01:28.01 --> 00:01:30.06
Now, often you'll hear the
term of a cracking a hash

31
00:01:30.06 --> 00:01:32.02
and I really wanna define what that means

32
00:01:32.02 --> 00:01:35.05
to crack a cryptographic hash.

33
00:01:35.05 --> 00:01:37.01
Essentially, there's a
couple ways to do that.

34
00:01:37.01 --> 00:01:40.01
The first is to find an
algorithm that can be used

35
00:01:40.01 --> 00:01:44.02
to generate a collision
between two hashes.

36
00:01:44.02 --> 00:01:45.07
Now, this is very difficult

37
00:01:45.07 --> 00:01:49.05
the more advanced the hash
algorithm is and some hashes,

38
00:01:49.05 --> 00:01:54.02
however, have become susceptible
to collision attacks.

39
00:01:54.02 --> 00:01:58.04
Another is finding an
algorithm to identify a unique

40
00:01:58.04 --> 00:02:01.09
and different input that
will yield a given hash.

41
00:02:01.09 --> 00:02:04.04
Now, this is similar to a collision,

42
00:02:04.04 --> 00:02:06.04
but instead of focusing on colliding,

43
00:02:06.04 --> 00:02:09.01
you're focusing on finding another input

44
00:02:09.01 --> 00:02:11.06
through the use of an algorithm.

45
00:02:11.06 --> 00:02:13.02
A couple of the most common hashes

46
00:02:13.02 --> 00:02:15.03
that we still see used today

47
00:02:15.03 --> 00:02:16.07
that are considering cracked

48
00:02:16.07 --> 00:02:21.02
from a cryptographic
perspective are MD5 and SHA-1.

49
00:02:21.02 --> 00:02:24.06
Any time you're actually
using these hash algorithms

50
00:02:24.06 --> 00:02:26.08
to do security-type work,

51
00:02:26.08 --> 00:02:29.05
you should stop and
rethink your life choices.

52
00:02:29.05 --> 00:02:31.07
If you're doing just
simple checksums on files,

53
00:02:31.07 --> 00:02:33.03
you might be okay,

54
00:02:33.03 --> 00:02:35.01
but just keep in the back of your mind

55
00:02:35.01 --> 00:02:38.02
that these are technically broken hashes.

56
00:02:38.02 --> 00:02:41.07
Now, what are some of the
actual uses of hashes?

57
00:02:41.07 --> 00:02:44.01
First and foremost is digital signatures.

58
00:02:44.01 --> 00:02:45.02
We're actually gonna take a look

59
00:02:45.02 --> 00:02:49.03
at the digital signature
engine in the next chapter.

60
00:02:49.03 --> 00:02:51.08
Another is digital fingerprints
and this is very similar

61
00:02:51.08 --> 00:02:55.03
to checksums where you're
actually printing a file

62
00:02:55.03 --> 00:02:59.01
with a hash so that anyone
who downloads that file knows

63
00:02:59.01 --> 00:03:03.04
that it matches the exact size
and content that you created

64
00:03:03.04 --> 00:03:06.02
when you put it out there
for them to download.

65
00:03:06.02 --> 00:03:09.04
Another very popular use case
and one that, in my opinion,

66
00:03:09.04 --> 00:03:13.03
is not used enough is the
logging of sensitive data.

67
00:03:13.03 --> 00:03:15.02
Let's say, for instance,
you're running a system

68
00:03:15.02 --> 00:03:17.02
that has email addresses.

69
00:03:17.02 --> 00:03:19.08
Well, you know that you shouldn't
log in the email address

70
00:03:19.08 --> 00:03:23.01
because that's personally
identifiable information.

71
00:03:23.01 --> 00:03:25.09
However, if you hash that email address

72
00:03:25.09 --> 00:03:27.09
and then log the hash,

73
00:03:27.09 --> 00:03:30.08
you can still find the
original email address

74
00:03:30.08 --> 00:03:33.05
by performing the same hash
and then searching the logs

75
00:03:33.05 --> 00:03:35.05
for that hashed value.

76
00:03:35.05 --> 00:03:38.05
This can be leveraged in
many different use cases

77
00:03:38.05 --> 00:03:41.00
in your organization where sensitive data

78
00:03:41.00 --> 00:03:46.07
or even secured data needs to
be logged in a secure manner.

79
00:03:46.07 --> 00:03:49.06
Finally and probably
the most common use case

80
00:03:49.06 --> 00:03:52.05
of hashes is saving passwords.

81
00:03:52.05 --> 00:03:54.05
But, I wanna leave a
little bit of a caveat

82
00:03:54.05 --> 00:03:57.03
to that saving passwords
because what we're gonna do

83
00:03:57.03 --> 00:04:02.01
in JCA really isn't sufficient
enough for the most part

84
00:04:02.01 --> 00:04:05.06
for saving passwords in
modern-day computer science.

