Secure Hash Function Properties

Preimage, Second-preimage, and Collision Resistance

Alex Rodriguez
6 min readSep 15, 2020

What makes a hashing function secure? Well before answering this, let’s define what a hashing function is and understand its purpose regarding cybersecurity. A hashing function is an irreversible cryptographic function that takes in an input and produces a unique, fixed-size, and compressed numerical value called a message-digest.

If you are familiar with associative arrays in programming, then you essentially understand the intent of a hashing function. The associative array (also known as a dictionary, map) data type used in programming languages utilizes that concept behind a hashing function in that they are used to associate one value with one particular key. Let me show you:

The example above shows that the map data structure in Go, as well all other implementations in other languages, operates like a hashing function because it restricts one key from mapping to more than one value which is the fundamental purpose of a hashing function: ensure that one value maps to one key (hash).

--

--

Alex Rodriguez

I am an Offensive Security Engineer @ Amazon who writes about cybersecurity and anything related to technology. Opinions are my own.