only the Hasher machine knows how to decode
I would say: "not even the Hasher machine can decode"
Now, let's apply this to a real-world scenario relating to something you might get. Imagine you have a school with lots of students, like this one, and each student has a locker. The lockers are labeled with unique codes, just like the codes from the Hasher machine.
Teachers want to use the lockers to store something important, like the students' grades. But they want to keep the grades private, so they put the grades in envelopes and lock them in the lockers using the codes. The codes are generated by the Hasher machine. Here's how the Hasher machine's properties relate to this scenario:
Representing the message: The code on each locker represents the student's grades. Teachers can tell which locker belongs to which student without actually looking inside the locker.
I don't get this example. The code on each locker represents the student's grade? Isn't the code on their locker independent from any grade they get? I assume you are talking about a code which identifies that this is their locker?
Thanks for the question, all questions help me perfect this. So ..
The code is a representation of the grade. So by looking at the code the teacher knows the grade for the student.
So for example
LockerGradeGrade (MD5 Hash)
1C0b90224d10e44e42f4891b2e5a2d4d16
2A7fc56270e7a70fa81a5935b72eacbe29
3Be9d71f5ee7c92d6dc9e92ffdad17b8bd
To anyone who does not know the code, they see the hash and have no idea what is happening. The teacher however knows the code and what grade they are linked to. The locker have names on. So the teacher can see that locker 1 (lets say john) has a grade of C
reply
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.
reply
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