Skip to content

Questions about Hash function

Short answers, pulled from the story.

What is a hash function and what does it do?

A hash function maps data of arbitrary size to fixed-size values called hash codes or hashes. Those values are used to index a hash table, giving near-constant data retrieval time regardless of the number of stored records.

Who invented the hash function concept?

Hans Peter Luhn of IBM appears to have been the first to use the concept of a hash function, in a memo dated January 1953. The term itself did not appear in published literature until the late 1960s, in Herbert Hellerman's Digital Computer System Principles.

What is a hash collision and how is it resolved?

A collision occurs when two different keys produce the same hash code and compete for the same slot in a hash table. It can be resolved by chained hashing, which stores colliding items in a linked list, or by open address hashing, which probes for the next empty slot using linear probing, quadratic probing, or double hashing.

What is Zobrist hashing and where was it first used?

Zobrist hashing, named after Albert Zobrist, was originally introduced for compactly representing chess positions in computer game-playing programs. It assigns unique random numbers to each piece type on each square of the board and combines them using XOR operations.

How are hash functions used in cybersecurity and cryptography?

Hash functions secure passwords by storing only the hash value rather than the plaintext. They also underpin message authentication codes such as HMACs, support file integrity checking, and allow digital signatures to be applied to a small hash of a message rather than the full message.

What is the strict avalanche criterion in hash function design?

The strict avalanche criterion requires that whenever a single input bit is changed, each output bit should change with a 50% probability. This property ensures that clustered or low-variability key sets still produce evenly distributed hash codes.