02 String Hashing Overview

Topic Progress:

What is it?

A string hash is a number or string generated using an algorithm that runs on text or data.

What is it used for?

The idea is that each hash should be unique to the text or data (although sometimes it isn’t). For example, the hash for “dog” should be different from other hashes.

How do you find the hash of a string?

You can use command line tools tools or online resources such as this one.

Example

$ echo -n password | md5  5f4dcc3b5aa765d61d8327deb882cf99

Here, “password” is hashed with different hashing algorithms:

SHA-1: 5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8
SHA-2: 5E884898DA28047151D0E56F8DC6292773603D0D6AABBDD62A11EF721D1542D8
MD5: 5F4DCC3B5AA765D61D8327DEB882CF99
CRC32: BBEDA74F

Tip

Generally, when verifying a hash visually, you can simply look at the first and last four characters of the string.