What's Hashing? (2022)
blog.dvsj.in
blog.dvsj.in
I try to ramp it up from a loose anology to slowly model the actual working (although I'm no expert on that!)
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.Directory of HHH, including the US https://www.gotothehash.net/
The other important hashing is the reduction of an object of any kind (including, but not limited to texts) being used as a key, to a numeric code (usually fitting into a single machine word) to be used as an index for fast look up in a "hash table" data structure.
This is related to testing whether two things are the same, but the security aspect isn't important. More important is the aspect that the hash code is exploited as an integer in order to jump to the right bucket or starting point in the hash table.
Hash tables can be on disk, not only in memory.
I never see this mentioned. For instance, look at the Wikipedia page on hashing; mainly some 20th century white dudes are mentioned there, and one A. D. Linh (Vietnamese-looking name) is credited with open addressing.
https://en.wikipedia.org/wiki/Hash_table#History
However, decades before that, Chinese character dictionaries used step-by-step algorithms for finding chinese characters in a dictionary, which are identical to hashing.
First you examine the character according to a list of precise rules, which have various cases. The cases assign numbers to parts of the character according to structural features, and those numbers are then combined to form a code, such as the "four corner code".
From the code, you can proceed directly to a page of the dictionary, where you search through a short list of characters that have the same code.
Unless there is prior art for that, that is where the credit lies.
https://en.wikipedia.org/wiki/Four-Corner_Method#Origin
"The Four-Corner Method was invented in the 1920s by Wang Yunwu, the editor in chief at Commercial Press Ltd., China. It was based on experiments by Lin Yutang and others."
The significant thing about the prior art also is that it was hashing non-textual, but rather graphical objects. A chinese character is text, of course, but the hashing method treats the features graphically. It's not looking at the etymologically correct radicals and components and using their individual code values, but purely visual features like crossings, boxes and dots.
Before the Four Corner method, there were existing numeric lookup methods for dictionaries, like using the 214 Kangxi radicals. That also a kind of proto-hashing method. However, the hashing function is difficult (you have to already know which part of the character is considered the radical and which radical that is under variation). The number of buckets is pretty large, resulting in long searches. The Four Corner Method is a refinement: you can hash any character without knowing what it its radical, and the code space is decently large to reduce the searching through collisons.
Please let me know what you think and check out other articles as well! One to get you started: https://blog.dvsj.in/obfuscation/
The equivalent of XOR with a one time pad level of math, or a replacement scheme for encryption?
(In other words, doesn't have to be secure, but covers the concept)
It's worth noting that MD5 is no longer considered a cryptographically secure hash function.
> MD5 is considered a weak hashing algorithm these days; we use BCrypt, which is stronger.
Other members of the SHA family are still fine to use.
They are arrived to them differently, and provide different purpose.