Hashing algorithm, its use?

I do not fully understand hashing algorithms. Does anyone want to explain this to me in a very understandable way.

thanks

EDIT: using it with usernames from a text file.

+8
algorithm hash
source share
4 answers

There are many hashing algorithms, but the basic idea is to quickly and (almost) uniquely create an identifier for a piece of data. This can then be used as an index in a table so that you can quickly view the data. Most hashing algorithms have collisions where two pieces of data will hash to the same value, but this is very rare for better algorithms.

For an example of why this might be useful, let's say I wrote the entire phone book for my city. Now, instead of doing a binary search, when I want to find someone's number, all I have to do is run my name through the hash algorithm, and then go directly to that index in my table.

+11
source share

Assuming you are asking someone to basically explain the use of mouse hashing about an array. Now imagine a huge array in which you want to find a specific piece of data that is located in only one slot of the array. Instead of repeating through an array, you can take input and use it to calculate the index. Using the same formula that you used to store data in an array, you can simply go to the location of the data you need, rather than a loop.

+2
source share

Hashing algorithms try to simplify the comparison of big data. Instead of comparing data with equality, it is enough to compare hash values.

There are many different hashing algorithms, some of which are cryptographic hashing algorithms such as MD5, SHA1, SHA256, etc. You have two equal hash values ​​that you can be sure that the data is the same.

+2
source share

A hash means a 1 to 1 ratio between data. This is a common data type in languages, although it is sometimes called a dictionary. A hash algorithm is a way to input input and always have the same output, the other known as a function from 1 to 1. The ideal hash function is that the same process always gives a unique result. So, you can tell someone, here is the file, and here is its md5 hash. If the file was damaged, then the md5 hash will be a different value.

In practice, the hash function always returns a value of the same size, for example, md5 () will always return 128 bits regardless of the size of the input. This makes a 1 to 1 ratio impossible. The cryptographic hash function takes extra precautions, making it difficult to create two different inputs with the same output, this is called a collision. It also makes function change difficult. Hash functions are used to store passwords, because if the attacker, where he gets the password hash, he forces the attacker to break the hash before he can use it to log into the system. To unlock hash attacks, take a word list or an English dictionary and find all the corresponding hash values, and then iterate the list for each password that is looking for a match.

md5 (), sha0 and sha1 () are all vulnerable to hash collision attacks and should never be used for anything related to security. Instead, use any member of the sha-2 family, such as sha-256.

+2
source share

All Articles