[Omake] SVN Commit: Mojave standard library (Rev. 12016)
Jason J. Hickey
jyh at cs.caltech.edu
Thu Aug 23 15:13:20 PDT 2007
Our hash was a little weak. Specifically, any sequence of text where
the characters code sum up to 6229 can be pumped without changing
the hash.
Changed this:
digest.(i) <- digest.(i) lxor (Array.unsafe_get hash_data (code + i))
To this:
digest.(i) <- (digest.(i) * 3) lxor (Array.unsafe_get hash_data (code + i))
This is from the s-box implementation at http://bretm.home.comcast.net/hash/10.html
I did some performance analysis, checking build times for omake. It is lost
in the noise at least on MacOS/Intel.
However, if performance is an issue we could to the shift and add (might be
faster than an multiply):
x <- ((x lsl 1) + x) lxor y
BTW, this topic isn't entirely random. I was working on a hash example
for the book.
----
Changes in libmojave/util:
+2 -2 lm_hash.ml
A hyperlinked version of this commit is available at
http://svn.metaprl.org/commitlogs/libmojave/2007-08.html#07/08/23.15:13:20
More information about the OMake-CVS
mailing list