We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Security

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What are Hashes?

By D. Costa
Updated: May 17, 2024
Views: 19,283
Share

Hashes are mathematical formulas that take a string of data of variable length, usually in the form of text, and convert it into shorter, fixed-length numeric values. Hashes are used frequently in computer databases in order to make searches faster and more efficient. They are also used in encryption to ensure that passwords are not compromised and to authenticate digital signatures, among other uses. Hashes also go by the name of hash functions, and can also be considered algorithms.

Hashes play a big role in facilitating database searches. In a database consisting of names, for example, if a user searches for “John Doe,” the computer would have to match up all of the characters in the search to those of every database entry. Every character in the name would have 26 different possibilities — the letters of the English alphabet — while the variable length of the entries would also slow down the search.

By contrast, applying a hash function would make the computer’s life much easier. Turning each text string into a series of numbers would simplify the search, because the computer would only have ten possibilities to check for each character: digits “0” to “9.” The fixed length of the number series also helps the computer do its job more efficiently.

In a database with a hash function applied, all entries have a corresponding, unique number. This is called a hash key. In this instance, when you make a search, the computer first applies the hash function to the input you’ve written, such as “John Doe.” This results in a numeric value, for example “456789.” The computer can then rapidly match this result to the hash key corresponding to the correct entry.

Hashes also function as digital signatures. For example, a sender, Robert, wants to send a document to someone and the recipient, Mary, wants to make sure the document hasn’t been tampered with while en route. The sender, Robert, only has to run the document through a hash function, which results in a numeric value. Robert then encrypts the hash key and sends the document along with the encrypted key.

Mary receives both items and decrypts the hash key. She can now see the numerical value that resulted from the document before it was sent. To verify that the document in her hands is the exact same one, she runs the document through a hash function on her computer. Lastly, she compares both keys. If they are the same, then the document wasn’t altered on its way to the recipient.

Many different hash functions exist, each with their own mathematical formulas. For a hash function to work, it must minimize any collision, which occurs when two database entries have the same hash key. Hash functions must also be one-way. That means you can produce a key from a database entry or document, but not the other way around. In other words, you cannot “reverse-engineer” the original document from its hash key.

Share
WiseGeek is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.

Editors' Picks

Discussion Comments
Share
https://www.wisegeek.net/what-are-hashes.htm
Copy this link
WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.

WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.