Current location - Quotes Website - Personality signature - What is a hash function?
What is a hash function?
Hash function is to convert the input of any length (also called pre-mapped pre-image) into the output of fixed length through hash algorithm, and the output is hash value.

This transformation is a compressed mapping. The hash value is usually much smaller than the input space. Different inputs may be hashed into the same output, so it is impossible to determine a unique input value from the hashed values.

Hash function can convert a data into a flag, which is closely related to every byte of the source data. Another characteristic of hash algorithm is that it is difficult to find the reverse order law.

Extended data:

Commonly used hash functions are:

1, direct addressing mode. Take the keyword or the linear function value of the keyword as the hash address. That is, H(key)=key or h (key) = a key+b, where a and b are constants (this hash function is called self-function).

2. Digital analysis method. Analyzing a set of data, such as the date of birth of a group of employees, we find that the first few digits of the date of birth are roughly the same.

3. The squares are taken from China and France. Take the middle number after the keyword is squared as the hash address.

4. Folding method. Divide the keyword into several parts with the same number of digits, the last part can be different, and then take the superposition sum of these parts (remove the carry) as the hash address.

Baidu Encyclopedia-Hash Function