DEV Community

Fernando Piancastelli
Fernando Piancastelli

Posted on

Hash Function 256 chars

This is a submission for DEV Computer Science Challenge v24.06.12: One Byte Explainer.

Explainer

A hash function takes a key or input data and maps it to a fixed-size, uniformely distributed value (hash), later used for data retrieval. It strives to be fast, only generate one possible hash per input and make key mapping possible in near constant time.

Additional Context

Hashes are hard to define because it has many similar concepts in the field, which are used almost interchangibly; it is especially hard not to confuse them with checksums - those are interested in data integrity, not mapping. Also, results uniformely distributed is an essential property to make use of the hash value constant in time, since no hash is more probable than another from the same function.
Another important distinction is to separate general hash functions to cryptographic ones: the latter takes computational effort to make a 1 to 1 mapping to input (any one input can only be represented by one hash) and to make the original input unguessable by the hash alone, among other differences.

Top comments (0)