fnv1a64

fun fnv1a64(bytes: ByteArray): Long

Computes the 64-bit FNV-1a hash of the given bytes.

The algorithm starts from the offset basis 0xCBF29CE484222325 and, for every byte, applies xor first and then multiplication by the prime 1099511628211, with all arithmetic wrapping modulo 2 to the power of 64. An empty array hashes to the offset basis itself. The result is the raw 64-bit pattern in a Long and may be negative. This function never throws.

FNV-1a is a non-cryptographic hash intended for hash tables and fast fingerprinting. It must not be used for security purposes.

Return

the 64-bit FNV-1a hash.

Parameters

bytes

the input to hash.


Computes the 64-bit FNV-1a hash of this string encoded as UTF-8.

The string is first converted to its UTF-8 bytes and then hashed with fnv1a64, so all documentation of that function applies. An empty string hashes to the offset basis 0xCBF29CE484222325. This function never throws.

Return

the 64-bit FNV-1a hash.