Hashing: Ensuring Integrity
A hash function is a one-way mathematical process that takes input data (of any size) and converts it into a fixed-size string of characters called a hash value or digest.
Key Properties of Hashes
- One-Way: You cannot reverse the hash to get the original data.
- Fixed Length: The output is always the same size (e.g., SHA-256 is 256 bits).
- Collision Resistance: It is highly unlikely that two different inputs will produce the same output.
- Common Use: Verifying file integrity (downloaded software) and storing passwords (never store passwords in plain text).
- Algorithms: MD5 (deprecated), SHA-256, SHA-3.
Digital Signatures
Digital signatures use asymmetric encryption to verify the authenticity and integrity of a message or document.
- The sender hashes the message.
- The sender encrypts the hash using their Private Key (this is the digital signature).
- The recipient uses the sender's Public Key to decrypt the signature, revealing the original hash.
- The recipient calculates a hash of the received message itself.
- If the two hashes match, the integrity and authenticity are confirmed.