What is a hash function. A hash function is a mathematical function that has the following three attributes:
Enter a string that can be of any size; it produces a fixed-size output; for a specific input string, the result can be calculated at a reasonable time. A string that corresponds to n bits whose hash value evaluates to O (n).
To make the hash function password safe, you need to attach the following three features: Collision resistance, stealth, puzzle friendly
Characteristic 1: Collision resistance
The collision here means that the same output is produced for two different inputs. If no one can find a collision for the hash function h (x), the function is said to have collision resistance.
Defined:
The hash function h takes the variable length block M as input, producing a fixed length hash value h = h (M).
M is the original image of H. Because H is a many-to-many mapping, there are multiple primitives for any given hash value H. If X≠y and H (x) =h (y) are met, it is called a collision.
Application: Information Digest
Used to verify the integrity of the data, that is, to determine whether the data has been tampered with.
Feature 2: Confidentiality
Defined:
The hash function h is secretive if: when its input r is chosen from a probability distribution of a higher order minimum entropy, the given H (r| | x) conditions down to determine that x is not feasible.
Application: Commitment
We call the promise of what we want to do. Here the promise is a digital process, the analogy is as follows: First select a number, put the number into the envelope, and then put the envelope on a table that everyone can see. After doing so, you can say that you have made a commitment to the numbers in the envelope, and before you open the envelope, even though you have made a promise, it is a secret for others. After that you can open the envelope and show the value of your commitment.
Feature 3: Puzzle friendly
Defined:
If for any n-bit output value y, assuming K selected from higher-order minimum entropy distribution, if a feasible method cannot be found, find x in a much smaller amount of time than 2 n times, guaranteeing H (k| | x) =y is established, then we call hash function h as a puzzle friendly.
Application: Search Puzzle
In this application, we'll build a search puzzle that is a mathematical problem that needs to be searched for a huge space to find a solution. There is no shortcut to the search puzzle, which means there is no other way to solve it than to search for a huge space.
Finally, you are welcome to scan the following two-D code to pay attention to my personal public number.