Module quickrand_hash

Random Number Generation With Hash Functions

The random numbers created by the functions in this module are not meant for cryptographic purposes.

.

Copyright © 2017-2022 Michael Truog

Version: 2.0.5 Jun 20 2023 17:54:03 ------------------------------------------------------------------------

Authors: Michael Truog (mjtruog at protonmail dot com).

Description

Random Number Generation With Hash Functions

The random numbers created by the functions in this module are not meant for cryptographic purposes.

Any functions that have a jenkins prefix use Bob Jenkins' lookup3 hashing (lookup3, May 2006). In my testing, the function jenkins_32 is 4 times slower than erlang:phash2/1 because jenkins_32 is implemented in Erlang. Both the jenkins_32 and jenkins_64 functions execute at a speed similar to crypto:hash(ripemd160,_) with crypto:hash(sha256,_) slightly faster and crypto:hash(sha512,_) slightly slower.

Any functions that have a jenkins64 prefix use Bob Jenkins' SpookyHash (SpookyV2, August 5 2012). In my testing, the function jenkins64_128 is 4.5 times slower than crypto:hash(md5,_) which provides the same number of bits, because the jenkins64 functions are implemented in Erlang.

The jenkins prefix functions are faster than the jenkins64 prefix functions due to avoiding Erlang bignums and both provide the same quality.

All the functions have been checked with the C++ implementations to ensure the same hash value is obtained, though this implementation forces numbers to be interpreted as big-endian.

Function Index

jenkins64_128/1

Bob Jenkins SpookyHashV2 Hash128.

.
jenkins64_128/2

Bob Jenkins SpookyHashV2 Hash128.

.
jenkins64_32/1

Bob Jenkins SpookyHashV2 Hash32.

.
jenkins64_32/2

Bob Jenkins SpookyHashV2 Hash32.

.
jenkins64_64/1

Bob Jenkins SpookyHashV2 Hash64.

.
jenkins64_64/2

Bob Jenkins SpookyHashV2 Hash64.

.
jenkins_32/1

Bob Jenkins lookup3 hashword for iodata.

.
jenkins_32/2

Bob Jenkins lookup3 hashword for iodata.

.
jenkins_64/1

Bob Jenkins lookup3 hashword2 for iodata.

.
jenkins_64/2

Bob Jenkins lookup3 hashword2 for iodata.

.

Function Details

jenkins64_128/1

jenkins64_128(MessageRaw::iodata()) -> non_neg_integer()

Bob Jenkins SpookyHashV2 Hash128.

jenkins64_128/2

jenkins64_128(MessageRaw::iodata(), Seed::non_neg_integer()) -> non_neg_integer()

Bob Jenkins SpookyHashV2 Hash128.

jenkins64_32/1

jenkins64_32(MessageRaw::iodata()) -> non_neg_integer()

Bob Jenkins SpookyHashV2 Hash32.

jenkins64_32/2

jenkins64_32(MessageRaw::iodata(), Seed::non_neg_integer()) -> non_neg_integer()

Bob Jenkins SpookyHashV2 Hash32.

jenkins64_64/1

jenkins64_64(MessageRaw::iodata()) -> non_neg_integer()

Bob Jenkins SpookyHashV2 Hash64.

jenkins64_64/2

jenkins64_64(MessageRaw::iodata(), Seed::non_neg_integer()) -> non_neg_integer()

Bob Jenkins SpookyHashV2 Hash64.

jenkins_32/1

jenkins_32(MessageRaw::iodata()) -> non_neg_integer()

Bob Jenkins lookup3 hashword for iodata.

jenkins_32/2

jenkins_32(MessageRaw::iodata(), Seed::non_neg_integer()) -> non_neg_integer()

Bob Jenkins lookup3 hashword for iodata.

jenkins_64/1

jenkins_64(MessageRaw::iodata()) -> non_neg_integer()

Bob Jenkins lookup3 hashword2 for iodata.

jenkins_64/2

jenkins_64(MessageRaw::iodata(), Seed::non_neg_integer()) -> non_neg_integer()

Bob Jenkins lookup3 hashword2 for iodata.


Generated by EDoc