Hash Function
The hash function is a one-way function, where the hash value cannot be returned to the initial data. Because it is one-way, the hash function can be used to secure passwords, so that what is stored in the database is the hash of the password. And if the database is breached by hackers, the hacker will not know our password because to reverse hash is almost impossible.
The hash algorithm is a function that is used to map data from random data into data that has a fixed size. The hash value, hash code, and hash count will be returned as long as the hashing function is running.
The input of the hash function is in the form of a message fingerprint or often also called a message digest. The hash function inputs vary in length, but the hash value output always has a fixed length. The value returned by the hash function can be a message digest or just a hash value. The types of hash functions include: MD2, MD4, MD, RIPEMD, SHA-0, SHA-1, SHA-256, SHA-512, and WHIRLPOOL.
The hash function can also be used for network security for example for data integrity and message authentication. Sending messages and receiving messages can be used to realize data integrity services. For example, M is a message and h is a hash function, then y = h(M) is called the message print x or often also called the message digest. Generally, message digests are around 512 bits in size.
The properties that must be owned by a cryptographic hash function include the following:
- Deterministic function : The same message always returns the same hash value.
- Quickly calculate hash values.
- Collision : It is not possible to have two messages with the same hash value.
- It is not possible to intentionally create messages that can generate a specific hash value.
- A slight change in the message should change the resulting hash value, so it doesn’t correlate with the original hash.