gor.bio wiki

Hash Functions

Deterministic functions that map arbitrary data to fixed-size digests, used for integrity checking, password storage, and digital signatures.

Category: Cryptography · Created: 2026-08-18 · Updated: 2026-08-18

A cryptographic hash function maps input of any length to a fixed-size digest, for example 256 bits for SHA-256, and has three defining properties: it is deterministic (the same input always gives the same digest), it is fast to compute, and it is one-way — given a digest, finding any input that produces it (preimage resistance) or finding two different inputs with the same digest (collision resistance) must be computationally infeasible. These properties make hashes the glue of modern security: they compress data to a compact fingerprint that can be compared, signed, or stored.

Hashes protect integrity. Downloading a file and comparing its SHA-256 digest against the publisher's value proves the bytes arrived unchanged; software packages, firmware, and container images are distributed this way. In public-key cryptography, signatures are computed over a hash of the message rather than the whole message — the signer's private key is applied to a small digest, which is both faster and safe because the one-way property prevents an attacker from forging a signature for a chosen message.

Password storage uses hashing differently: plain hashes are vulnerable to dictionary and rainbow-table attacks, so systems store salted, slow hashes such as bcrypt, scrypt, or Argon2, where the salt is a random value per password and the cost parameter makes brute force expensive. HMAC builds message authentication codes by hashing a key together with the message, and hash-based key derivation (HKDF) turns a weak shared secret into strong session keys.

Not every hash is safe for security. MD5 and SHA-1 were once ubiquitous but are now broken — collisions for both have been demonstrated — so they must not be used where an adversary matters, while SHA-2 and SHA-3 remain sound. Note the distinction from the non-cryptographic hashes used inside hash tables: those optimize for speed and distribution over a small table, not for adversarial resistance, and the two families serve completely different purposes. TLS certificates (HTTP and HTTPS) chain integrity to hash-based signatures, making hash function security part of the foundation of the web.

Tags

cryptography data integrity hashing security

Related articles

This text may be freely copied, modified, and reused. See Content Reuse.

Click here for easy-to-read helpful e-books for anyone, anywhere, and about anything