What is hash? Hash application
This article will explain to you what is a hash function? How it is used and its application.
- Binary Search algorithm (Binary Search)
- Browse trees in data structures and algorithms
- 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.
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.
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.
- 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.
You should read it
- What is Cryptographic Hash (cryptographic hash function)?
- Hash Table data structure
- Dissection attacks Pass the Hash
- The hash () function in Python
- How to fix status_invalid_image_hash error on Microsoft Edge
- List of file names, HASH SHA-256 codes containing WannaCry malware
- How to hash and verify passwords in Node.js using bcrypt
- NBMiner releases 'hack' that can restore 70% of 'mining' performance on NVIDIA's Ampere LHR GPU
- How to create a torrent magnet link with info hash
- How can Windows passwords be cracked - Part 2
- What is 51% attack? How does 51% attack work?
- Collection in C #
Maybe you are interested
What are hashtags? How to use hashtags and their uses?
Latest Code Will of Hashira
How to hash and verify passwords in Node.js using bcrypt
List of file names, HASH SHA-256 codes containing WannaCry malware
How to fix status_invalid_image_hash error on Microsoft Edge
How to create a torrent magnet link with info hash