# hash function

The hash function is a cryptographic checksum for a message to ensure its integrity. It is a mathematical function that must satisfy certain properties that can be used to adequately describe the hash function.

Among these properties, the input string can be of arbitrary length and can be computed effectively. Furthermore, the output-side string has a fixed size, independent of the length of the input string. For example, it can be between 128 bits and 256 bits long.

The hash method is used to reduce the computational effort involved in encryptingdata using the public- key method. A hash function is applied to the message, which has a variable length, to generate a fixed-length checksum, the hash value. This allows the integrity of a message to be established beyond doubt. The hash value is digitally signed and appended to the message. The recipient applies the same hash function to the message and compares the result with the decrypted digital signature. Secure hash functions are non-invertible and collision-free. Thus, there are never two texts that have the same hash value. The SHA algorithm (SHA-1) with a hash value length of 160 bits and the MD5 algorithm with 128 bits can be cited as hash functions. The longer the hash value, the more computing time is required to determine it. If it is 128 bits long and the computer can determine 10,000 hash values per second, then it takes `10^27` years to calculate them.