Exim nhash algorithm
This is an implementation of the Exim nhash algorithm. It also supports an
arbitrary number of divisors and not just the one or two that Exim permits.
The nash algorithm is a fast and simple hashing algorithm that attempts to
evenly-distribute values but does not attempt to avoid collisions. Thus, it
should not be used in place of a cryptographically-secure algorithm such as
Digest::SHA. It is mainly intended for hashing filenames into directories
to avoid placing too many files into a single directory.
If nhash is not given any divisors, then the hash result is returned as-is.
If one divisor is given, the hash result is given modulo that divisor. If
more than one divisor is given, the hash result is successively divided and
the modulo at each stage returned.
Since the result is typically a 20-30 bit number, the product of all the
divisors shouldn't be more than about 2**20 or the returned values will not
Ei virallista pakettia saatavilla: openSUSE Leap 15.4