NEW
Also known as: Data Encoding
Transforming input data to a fixed-size output using a deterministic algorithm, often for indexing, integrity, or security.
DESCRIPTION
Hashing applies a deterministic function to map arbitrary-length input to a fixed-size digest. Cryptographic hashes (e.g., SHA-256) are designed to be collision-resistant and preimage-resistant. Non-cryptographic hashes power hash tables and partitioning. Use cases include integrity checks, deduplication, password storage (with salting and key stretching), and load balancing via consistent hashing. Selection must align with security and performance needs.
ALTERNATIVE DEFINITIONS
NIST
A function that maps a bit string of arbitrary length to a fixed-length bit string.
Concise formal definition of a hash function’s mapping.
Wikipedia
A hash function is any function that can be used to map data of arbitrary size to fixed-size values.
General-purpose definition across contexts.
Cloudflare
A cryptographic hash function takes an input and returns a fixed-size string of bytes. The output is typically a ‘digest’ that is unique to each unique input.
Focuses on cryptographic properties and uniqueness expectations.
RELATED TERMS
Hash Table Cryptographic Hash SHA-256 MD5 Checksum Salting Bloom Filter Fingerprint Consistent Hashing
COMPETING TERMS
RELATIONS
- Narrower: Consistent Hashing Feature Hashing Locality-Sensitive Hashing NTLM Windows Hashing Password Hashing
KNOWLEDGE AREAS
Data Security Data Engineering Mathematics Software Engineering Data Storage & Operations
TARGET AUDIENCE
Software Developer Data Engineer DevOps Engineer Data Architect
EXTERNAL SOURCES
- Wikipedia - Hash function
- NIST - Official hash function definition
- IETF - SHA implementations and definitions
- Cloudflare - Cryptographic hash overview
TOP QUESTIONS
What makes a hash function cryptographically secure?
It should be preimage-resistant, second-preimage-resistant, and collision-resistant. Modern choices include SHA-256 and SHA-3.
Category: Requirements
How is hashing different from encryption?
Hashing is one-way and irreversible; encryption is reversible with a key. They serve different purposes.
Category: Misunderstanding
Why add salt to hashed passwords?
Salts prevent precomputed attacks and make identical passwords produce different hashes, strengthening security.
Category: BestPractice
What are common non-cryptographic hashes?
MurmurHash, xxHash, and CityHash are fast for hash tables and partitioning but not for security.
Category: Technology
What is consistent hashing used for?
It distributes keys across nodes while minimizing remapping during scaling, useful in distributed systems.
Category: Application
Can two inputs share the same hash?
Yes, collisions are possible due to pigeonhole principle, though rare for good functions.
Category: Explanation
How to verify file integrity with hashing?
Compute and compare checksums (e.g., SHA-256). Use authenticated methods for tamper resistance.
Category: BestPractice
Is MD5 still safe?
No. MD5 is vulnerable to collisions and should not be used for security-sensitive purposes.
Category: Risk
Where is hashing used in databases?
Hash indexes, partitioning, deduplication, and change detection rely on hashing for speed and integrity.
Category: Application