What is the Hash Functions in DSA?
A Hash Functions are important component of hashing, which is used for designed to efficiently map data of arbitrary size to fixed-size values, typically integers. These fixed values are also known as hash codes which serves as indices in a hash table, allowing for quick data retrieval.
The Primary Goal of Hash Functions is to distribute input data uniformly across the hash tables to minimize collisions and maintain efficient operations.
Types of Hash Functions
- Division Methods
- It computes the Hash Functions Code by dividing the input data by a prime number and using the remainder as the hash code.
- Formula: – h(k) = k mod m, where k is the input key and m is the size of the Hash Table.
- Multiplication Method
- Multiplies the input data by a constant (typically a fraction), extracts the fractional part, and multiplies it by the Hash Table size.
- Formula: – h(k) = [m. (k. A mod 1), where A is constant.
- Universal Hashing
- Uses a family of hash functions to minimize the probability of collisions, selecting a different hash function for each execution.
- Cryptographic Hash Function
- Designed to provide security properties such as collisions resistance (difficult to find two inputs that produce the same hash) and pre-image resistance (difficult to reconstruct the input from the hash).
- Commonly used in security applications like digital signatures and data integrity checks.
- Example include SHA-256 and MD5