A hash function takes any input (text, file, data) and produces a fixed-length string of characters called a hash or digest. The same input always produces the same hash, but even a tiny change in input produces a completely different hash. This property makes hashes essential for data integrity verification, password storage, and digital signatures.
Common Hash Algorithms
MD5 produces a 128-bit (32-character) hash. While fast, it is no longer considered secure for cryptographic purposes, but remains widely used for checksums and non-security applications. SHA-1 produces a 160-bit (40-character) hash and is also deprecated for security use. SHA-256 and SHA-512 (part of the SHA-2 family) are the current standard for secure hashing, producing 256-bit (64-character) and 512-bit (128-character) hashes respectively.
Practical Uses for Hash Functions
Developers use hashes for verifying file integrity (comparing checksums), storing passwords securely (hashed, not plain text), generating unique identifiers, digital signatures, and data deduplication. If you download a file and want to verify it wasn't tampered with, compare the hash of your downloaded file with the official hash provided by the publisher.