3 ms·
The example is… not the best: if you’re checking if two pages are identical, you should match up each byte and compare them byte for byte. Hashing just adds an
by vore 3y ago
The example is… not the best: if you’re checking if two pages are identical, you should match up each byte and compare them byte for byte. Hashing just adds an extra step: you’re going to need to read every byte anyway!
- RichieAHB 3y agoGiven this is for a non-tech audience I think this is reasonable. It basically talks about it being a lossy encoding of things that represent the original. Also, if the words / chars were stored as an array or string already you wouldn’t need to read every byte.
- js2 3y agoYup. A better example might be something like assigning all the letters a number value (a 1, b 2, ...) and then summing all of them. It's important that the analogy be simple to comprehend but it should still be, well, analogous to the real process.
- ctxc 3y agoHi js2! I do it in the immediate next section, "Improving the algorithm" (take all the letters and assign a number value). Do you think there's a way I can improve that part or say that better? I try to ramp it up from a loose anology to slowly model the actual working (although I'm no expert on that!)
- Kalium 3y agoThe webpage example does a good job of setting the stage for passwords. You definitely do not want to compare passwords that way unless you are trying to create a textbook timing vulnerability.
- ctxc 3y agoHello Vore! Yes, of course. I wrote this for a few non technical friends - a simple example they can relate to (like we skim docs) seemed like the best way to start off without scaring them off the article :P
- dspillett 3y ago> you’re going to need to read every byte anyway! But you might not need to read them at your current location, though that consideration might be overkill for the level this article is aimed at. For instance reading a full remote file to compare it to a local one byte-for-byte will be slower than sha256sum some.file; ssh user@host sha256sum some.file or cmp <(sha256sum some.file) <(ssh user@host sha256sum some.file) unless the file is very small (in which case a simple download by HTTP(S) or read via network filesystem may be faster than negotiating a SSH connection and running the remote hash command). In either case accessing a pre-computed hash of the remote content will likely be faster than both options, assuming a stored hash exists and you are looking to verify your local copy.