What is a secure hash algorithm
A hash algorithm or hashing function is a procedure in which data of an arbitrary length (pre-image, message, input) is transformed in a reproducible way (mapped) to data of a fixed length. (hash, digest, output). This allows for computationally efficient storage and retrieval of data. Secure hash algorithms are fundamentals of cryptography. They have the following features:- One way function or pre-image resistance. It's much easier to calculate the hash from the data than to calculate the data from the hash. Think of a physical telephone book. It's easy to get a phone number from a name, but it's difficult to get a name from a phone number.
- Second pre-image resistance. Starting with a specific input, it's hard to find another input that has the same hash value. For instance, raising a real number to its third power has 100% pre-image resistance.
- Collision resistance. It's difficult to find any pair of inputs that hash to the same output.