pull down to refresh

Ah, okay, now I see.
However, two things:
  1. Any student with the same grade will have the same hash
  2. A smart child may realize they can just put every grade into the Hasher machine and compare the hashes. This assumes that the Hasher machine is publicly accessible (which should be the case if you want to have a good analogy to hash functions).
Because of this, I would say this example is not a good use case for hashing, to be honest. Non-deterministic encryption with a secret key should be used here.
If you have any suggestions I would appreciate another analogy
reply
You can fix your example by using salt || MD5(grade || salt || secret) as the code on the lockers.
salt is just a random value which makes sure that every hash will be different.
secret is a secret value which only teachers know. This prevents that students can just try every grade and compare hashes.
With || I mean concatenation.
This may be too complicated for 8 graders now though.
reply