Hash

Hashing is a technique to convert any amount of data onto a data of fixed size, this is generated using a hashing function and it backed by mathematics and science

Uses of Hashes

  • we can generate a checksum to check if a message was altered during transit, these are used in WiFi and Ethernet to check if the data was properly transmitted or not
  • Cryptography/Signature - See if a message came from a trusted source
  • enables fast lookup of data, Example - database tables.

Good Hash Functions have the following

  • Deterministic - There can be no randomness and must get the same output for the same input data every time.
  • Uniform Distribution- Should have an equal chance of generating any value with the range of it’s outputs - values do not collide or overlap
  • Sensitive - Any change in input should provide a change in the output
  • One-Way - There should be no way to decipher or retrieve the original data from the Hash.

Two of the popular hash function are MD5 and SHA256