What Is Hashing?

Written by Coursera Staff • Updated on

Hashing is an encryption technique used in cybersecurity to protect and manage information. Learn more about what hashing is and how it’s used.

[Featured image] A cybersecurity tech in a gray shirt stands up looking at a tablet in front of a wall of video security monitors.

Hashing is a data security technique used to convert data values into alternate, unique identifiers called hashes for quick and secure access. Hashing can be used for data security because the one-way process prevents access to or tampering with the source data.

What is a hash function?

A hash function is an algorithm that transforms any amount of data into a fixed-length element or string. A good hash function ensures that even tiny changes in input data will produce dramatically different hash outputs. This property is crucial for security applications, where the hash function must make it nearly impossible to derive the original input from the hash.

How is hashing used?

In computer science, hashing is a technique used in data structures like hash tables, where it converts inputs of any size into a fixed-size string of characters, typically in numerical format. You can perform this through hash functions. It takes data. like a name or a file, and creates a unique hash for it.

Data retrieval

One of the primary uses of hashing is data retrieval. Hash tables, for instance, use hashing to store and retrieve data efficiently. When you add data to a hash table, the hash function computes a hash for that data. This hash then determines where the data is stored. When you need to retrieve the data, the hash function calculates the hash again and directly accesses the location of the data. This process makes data retrieval incredibly quick, regardless of the size of the data.

Cryptography

Another significant use of hashing is in the field of cryptography, specifically in verifying data integrity. In digital signatures, for example, a document’s hash is encrypted with a private key to create the signature. The recipient can then use the sender's public key to decrypt the signature, recompute the hash, and compare it to the received hash. If the hashes match, the document is authentic and untampered with.

What are the limitations of hashing?

Despite its benefits, hashing does have limitations. A hash collision occurs when different inputs produce the same hash output. While good hash functions make this highly unlikely, it's not impossible. Also, hashing is a one-way function, so you can't get the original data from the hash. While this is good for security, it's not ideal for situations where you need to retrieve the original data.

Learn more with Coursera 

Start building job-ready skills in cybersecurity with the Google Cybersecurity Professional Certificate on Coursera. Get hands-on experience with industry tools and examine real-world case studies, all at your own pace. Upon completion, you’ll have a certificate for your resume and be prepared to explore job titles like security analyst, SOC (security operations center) analyst, and more. 

Keep reading

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.