Jenkins hasher

    Dark Mode
Search:
Group by:

For impementation details and reasoning see the Jenkins Hasher article in the Dr. Doobs magazine.

The current implementation is taken from the Perl Digest::JHash xs code and tested against this module (see Digest::JHash(3pm) POSIX manual.)

Example:

var blurb =
  "How much wood could a woodchuck chuck. "   &
  "If a woodchuck could chuck wood? "         &
  "As much wood as a woodchuck could chuck, " &
  "If a woodchuck could chuck wood."

doAssert blurb.jHash == 0x61010c8u32

Procs

proc jHash(s: string): uint {...}{.raises: [], tags: [].}
Map an arbitrary string to a 32 bit value using the Jenkins Hasher algorithm.