#Hashing (Hashing Values)

By Dietmar Kühl

Hashing values is an important technique for efficient associative containers. It has multiple independent dimensions of considerations. None of these considerations is generally well understood. This presentation scratches the surface of the following areas:

  • Using hash functions for associative containers.

  • Hashing byte sequences into hash values and assessing the quality of hash functions.

  • Extracting byte sequences from values and hashing the resulting byte sequences.

  • Things to consider for a default hashing function.

The creation of containers and hashing functions is typically done by specialists. The primary intention of discussing them is to give an idea why applications should stay away from custom implementations. On the other hand provision of hash values for user-defined types is rather common-place to support their use as keys of associative containers. Thus, this presentation will have an emphasis on the important aspects for providing hash values for user-defined types:

  • The relation between equality and hash values.

  • Taking care of sequences to avoid collisions for empty sequences.

  • Interaction of hash values between different types ("transparency").

The code examples use C++. However, the various considerations are language independent and their understanding will be useful when using other programming languages, too.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.