Douglas Crockford




Cloud Expo

2019 Appearances






How JavaScript Works


A hash function is a function that turns a big string of bits into a much smaller, randomish string of bits. They are used to implement scatter index data structures such as hash tables. They can also be used to secure documents.

There is a class of hash algorithms that multiply or divide the big string by some number, usually a prime, and take some part of the result. There is another class that stirs the bits by shifting left and right while mixing by adding or exclusive orring. It occurred that these could be combined. Most CPUs know how to produce a multiplication product containing twice as many bits as the operands. Most programming languages throw those precious bits away, which is a type error.

A multiply does the work of many left shifts and additions very quickly. Adding in the extra high order product bits is effectively a massive right shift. So we can get a high quality hash, and get it very quickly and easily. It is a fast hash. Fash.

Secure hashes are another matter. Nearly all of the proposed secure hashes have been shown to have weaknesses or failures. Every hash algorithm designer is blind to his hash's weaknesses. That is why I think that Fash can be made into a secure hash by enlarging it. There is likely a fundamental flaw in my reasoning, but like all of the other hash makers, I can not see it.

I also made random number generators out of Fash. One has a very long period, so I claim it is secure, but its security really depends on the quality of the seeding.