What is hash? Hash application

This article will explain to you what is a hash function? How it is used and its application.

This article will explain to you what is a hash function? How it is used and its application.

  1. Binary Search algorithm (Binary Search)
  2. Browse trees in data structures and algorithms
  3. AVL tree in data structure and algorithm

1. What is hash?

Hash is an English word, meaning Vietnamese is hash. In cooking, to hash something means cut and then mix it. It's from there that we have Hash brown - fried or fried potato chips for breakfast in England. In computer science, the hash function takes an input of any length and content (for example, letters, numbers and symbols) and uses mathematical formulas to cut, mix and create lengthy output can.

For example, look at the value below:

 c017dcaadb04d44b6012b2a055786c77 

Do you recognize it? This is taken from 14 lines of poetry in Shakespeare's Sonnet 18 starting from "Shall I compare the to a summer's day?" and create an output of only 32 characters.

We can create a hash of nearly all digital content: documents, images, songs or anything.

Picture 1 of What is hash? Hash application

Any digital content at the lowest level is just a string of numbers 0 and 1. Everything can be represented in binary form.Hello example ! in binary UTF-8 is 01001000 01100101 01101100 01101100 01101111 00100001. This is the binary code where the hash function is disturbing.

There are many different mathematical formulas that you can use to create a hash. In fact, not all hashes are long. Each hash function merges and mixes in different ways and thus produces different outputs. For the previous hash value use the hash function called MD5 which stands for Message Digest. Some hash functions create long hash values ​​such as SHA3–512 (Secure Hash Algorithm 3) creating a 128 character hash.

When using the same content on the same hash function, you will get the same output. In this way, the 32-character string works a bit like the digital fingerprint of the content. Let's see what happens when you change a word in Shakespeare's Sonnet poem (summer into winter in the first line).

Original: 017dcaadb04d44b6012b2a055786c77

New: ab7b6da7342ea2599198c3ba3e884b55

They are completely different, right? You cannot see any connections, except that the string is hexadecimal (that is, use 16 symbols, 0-9 and af, a process commonly used in computing as a simple way to binary performances). Just like human fingerprints are unique, nobody resembles anyone, even a small change to a piece of content will lead to a completely new hash.

2. Hash application

Hash is used for cryptography because it conceals the original data with a different value. Hash functions can be used to create a value that you can only decrypt by looking up from the hash table. This table can be an array, database or data structure. A good cryptographic hash function is irreversible.

Picture 2 of What is hash? Hash application

Different types of compression, such as media compression and lossy image compression (lossy), can combine hash functions to reduce file size. By hashing data into smaller values, media files can be compressed into smaller pieces. This one-way hash type is not reversible but it can generate data as close as the original data but requires less disk space.

  1. Top software to extract files and compress files today

Hash is also used to create checksum (checksum value), confirming the integrity of the file. Checksum is a small value that is created based on bits in a file or data block such as a disk image. When the checksum function runs on a copy of the file (such as a file downloaded from the Internet), it creates a hash value like the original file. If the file does not create the same checksum, the file has been changed.

Finally, hash is used to index data. The hash value can be used to map each bucket data in a hash table. Each bucket has a unique ID that acts as a pointer to the original data. This creates a much smaller index than the original data, allowing values ​​to be searched and accessed more efficiently.

Update 12 August 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile