Cryptographic Hash Functions
Cryptographic Hash Functions
A cryptographic hash function is a mathematical algorithm that transforms an input (or ‘message’) into a fixed-length string of bytes. The output, known as the hash value or digest, is unique to each unique input. These functions are designed to be fast to compute, infeasible to reverse (pre-image resistance), and resistant to finding two different inputs that produce the same output (collision resistance).
Characteristics:
- Deterministic: The same input always produces the same output.
- Quick to compute: Efficiently generates the hash for any given input.
- Pre-image resistance: Given a hash, it should be computationally infeasible to find the original input.
- Small changes alter the hash: A minor change in the input should produce a significantly different hash.
- Collision resistance: It should be difficult to find two different inputs that yield the same hash.
Examples:
- SHA-256: Widely used in Blockchain technologies and security protocols.
- MD5: Commonly used for Checksums but considered insecure for cryptographic purposes.
- Scrypt: Used for password hashing and key derivation.
Use Cases:
- Data integrity: Verifying that data has not been altered.
- Digital signatures: Ensuring authenticity and integrity of messages.
- Password storage: Storing hashed passwords to enhance security.
- Blockchain: Ensuring the integrity of transactions in a distributed ledger.