Computers, Programming
Hash function: what is it, what is needed and what happens
Often when downloading torrents or directly the files themselves in the description is something like "ad33e486d0578a892b8vbd8b19e28754" (for example, in ex.ua), often with a postscript "md5". This hash code is the result that the hash function produces after processing the incoming data. In a translation from English, the hash means confusion, marijuana, grass or a dish of finely chopped meat and vegetables. It is very difficult to decipher the hash, we can say that it is almost impossible. Then the question arises: "Why do all these hash functions at all , if they give out an incomprehensible abracadabra, which still does not lend itself to deciphering?" This will be discussed in this article.
What is a hash function and how does it work?
Why do I need a hash function?
Hash functions: what they are like
1. Function for checking the integrity of information
When data is transmitted over the network, the hash of the packet is calculated, and this result is also transmitted along with the file. Upon receipt, the hash code is computed again and compared with the value obtained over the network. If the code does not match, then it indicates errors, and the corrupted package will be transferred again. Such a function has a fast calculation speed, but a small number of hash values and poor stability. An example of this type: CRC32, which has only 232 differing values.
2. Cryptographic function
This type is used to protect against unauthorized access (ND). They allow you to check if the data corruption occurred as a result of ND during the transfer of files over the network. The true hash is publicly available in this case, and the hash of the received file can be calculated using many different programs. Such functions have a long and stable working life, and the search for collisions (possible coincidences of the result from different initial data) is very complicated. It is these functions that are used to store passwords in the database (SH1, SH2, MD5) and other valuable information.
3. A function designed to create an effective data structure
Its goal is a compact and fairly orderly organization of information in a special structure, which is called a hash table. Such a table allows you to add new information, delete information and search for the right data at a very high speed.
Similar articles
Trending Now