Core Properties of Cryptographic Hash Functions
A cryptographic hash function is a mathematical algorithm that maps arbitrary-length input data into a fixed-size bit string (digest). True cryptographic hashes satisfy five foundational properties: 1. Deterministic: Identical inputs always yield the identical hash. 2. Quick Computation: Low latency for arbitrary data streams. 3. Pre-image Resistance (One-Way): Infeasible to reconstruct the original input from the hash. 4. Avalanche Effect: Changing a single input bit completely alters the resulting hash output. 5. Collision Resistance: Infeasible to find two distinct inputs that produce the same digest.
// Avalanche Effect Demonstration (SHA-256)
// Input 1: "WebCraftKit"
// Hash 1: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
// Input 2: "webcraftkit" (Only 2 casing changes)
// Hash 2: 4a8b7921a4f009be4d3c9071c324e9314de80df0a424177d4c5c2e0b57e79c4a