Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74963 - trunk/libs/functional/hash/doc
From: dnljms_at_[hidden]
Date: 2011-10-16 06:32:13


Author: danieljames
Date: 2011-10-16 06:32:12 EDT (Sun, 16 Oct 2011)
New Revision: 74963
URL: http://svn.boost.org/trac/boost/changeset/74963

Log:
Hash: A few edits to the new rationale.
Text files modified:
   trunk/libs/functional/hash/doc/rationale.qbk | 27 +++++++++++----------------
   1 files changed, 11 insertions(+), 16 deletions(-)

Modified: trunk/libs/functional/hash/doc/rationale.qbk
==============================================================================
--- trunk/libs/functional/hash/doc/rationale.qbk (original)
+++ trunk/libs/functional/hash/doc/rationale.qbk 2011-10-16 06:32:12 EDT (Sun, 16 Oct 2011)
@@ -14,8 +14,8 @@
 and output values. They attempt to uniformally distribute the output
 values for very similar inputs. This hash function makes no such
 attempt. In fact, for integers, the result of the hash function is often
-just the input value. So similar but different input values will result
-in similar but different output values.
+just the input value. So similar but different input values will often
+result in similar but different output values.
 
 This means that it is not appropriate as a general hash function. For
 example, a hash table may discard bits from the hash function resulting
@@ -25,28 +25,23 @@
 
 So why not implement a higher quality hash function? Well, the standard
 makes no such guarantee, it just requires that the hashes of two
-different values are unlikely to collide. So containers or algorithms
+different values are unlikely to collide. Containers or algorithms
 designed to work with the standard hash function will have to be
 implemented to work well when the hash function's output is correlated
-to its input. Since they are paying that cost it would be wasteful to
-expand the effort to make a higher quality hash function.
+to its input. Since they are paying that cost a higher quality hash function
+would be wasteful.
 
-If you do need a higher quality hash function, there are several options
+For other use cases, if you do need a higher quality hash function,
+there are several options
 available. One is to use a second hash on the output of this hash
 function, such as [@http://www.concentric.net/~ttwang/tech/inthash.htm
-Thomas Wang's hash function]. But for many types this might not work as
+Thomas Wang's hash function]. This this may not work as
 well as a hash algorithm tailored for the input.
 
 For strings that are several fast, high quality hash functions
-available, such as:
-
-* [@http://burtleburtle.net/bob/hash/index.html Bob Jenkins' hash
- functions]
-* [@http://www.azillionmonkeys.com/qed/hash.html Paul Hsieh's hash
- functions]
-* [@http://code.google.com/p/cityhash/ Google's CityHash]
-* [@http://code.google.com/p/smhasher/ MurmurHash3]
-
+available (for example [@http://code.google.com/p/smhasher/ MurmurHash3]
+and [@http://code.google.com/p/cityhash/ Google's CityHash]),
+although they tend to be more machine specific.
 These may also be appropriate for hashing a binary representation of
 your data - providing that all equal values have an equal
 representation, which is not always the case (e.g. for floating point


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk