DEV Community

Cover image for How JavaScript uses hashing
thabang21
thabang21

Posted on

How JavaScript uses hashing

What is hashing and what is it used for

  • Hashing is the process of converting a given key into another value.
  • Hashing is used for authentication.

What a hash table is and what the benefits of this data structure are:

  • hash table (hash map) is a data structure that implements an associative array abstract data type, a structure that can map keys to values.

Benefits of hash table

  • Hash tables are data structures that make finding data a lot quicker

  • Hash tables are more efficient than search trees or any other table lookup structure

Difference between hashing and encryption

  • Encryption: Reversible transformation of data format, used to preserve usability of data.
  • Hashing: Is a one-way summary of data, cannot be reversed, used to validate the integrity of data

What is map object

The Map object holds key-value pairs and remembers the original insertion order of the keys.

Comparison between objects and maps:

Map:
  • A Map's keys can be any value (including functions, objects, or any primitive).

  • The number of items in a Map is easily retrieved from its size property.

Object:
  • The keys of an Object must be either a String or a Symbol.
  • The number of items in an Object must be determined manually.

Reference:

Top comments (0)