class RemiLib::Digest::SpookyHash
- RemiLib::Digest::SpookyHash
- Reference
- Object
Overview
An implementation of SpookyHash that produces 128-, 64-, and 32-bit hashes.
Defined in:
remilib/digest/spookyhash.crremilib/digest/spookyhash/globals.cr
remilib/digest/spookyhash/spookyhashinternal.cr
Constant Summary
-
VERSION =
"1.0.7"
-
The version of the algorithm that's supported.
Constructors
-
.new(seed1 : UInt64, seed2 : UInt64)
Creates a new
SpookyHash
instance. -
.new
Creates a new
SpookyHash
instance.
Class Method Summary
- .calculate128(input : Bytes, inputHash : UInt128 = 0) : UInt128
- .calculate32(input : Bytes, seed : UInt32 = 0) : UInt32
- .calculate64(input : Bytes, seed : UInt64 = 0) : UInt64
Instance Method Summary
-
#hash : UInt128
Generates an
UInt64
hash value for this object. - #hash32 : UInt32
- #hash64 : UInt64
- #update(input : Bytes) : Nil
Constructor Detail
Creates a new SpookyHash
instance. seed1 is the first eight bytes of a
custom seed, while seed2 is the last eight bytes of a custom seed.
Class Method Detail
Instance Method Detail
Generates an UInt64
hash value for this object.
This method must have the property that a == b
implies a.hash == b.hash
.
The hash value is used along with ==
by the Hash
class to determine if two objects
reference the same hash key.
Subclasses must not override this method. Instead, they must define hash(hasher)
,
though usually the macro def_hash
can be used to generate this method.