murmur3a
Types
Values
pub fn bit_array_digest(hash: Hash) -> BitArray
Returns 32 bit digest of the hash as a BitArray.
Examples
hash_string("murmur3a", 0)
|> bit_array_digest
// -> <<232, 177, 21, 28>>
pub fn hash_bytes(key: BitArray, seed: Int) -> Result(Hash, Nil)
Computes a 32 bit Murmur3 hash of the supplied bit array.
Returns Error(Nil) if the bit array is not byte-aligned.
Examples
hash_bytes(<<"murmur3a">>, 0)
// -> Ok(Hash(3521997819, 0, -391047908))
pub fn hash_ints(key: List(Int), seed: Int) -> Hash
Computes a 32 bit Murmur3 hash of the supplied list of integers.
Note: Values outside the 0–255 range will be truncated to their lowest byte before hashing.
Examples
hash_ints([1, 2, 3], 0)
// -> Hash(0, 24, -2133732860)
pub fn hash_string(key: String, seed: Int) -> Hash
Computes a 32 bit Murmur3 hash of the input string.
Examples
hash_string("murmur3a", 0)
// -> Hash(3521997819, 0, -391047908)
pub fn hex_digest(hash: Hash) -> String
Returns a hexadecimal digest of the hash.
Examples
hash_string("murmur3a", 0)
|> hex_digest
// -> "E8B1151C"
pub fn int_digest(hash: Hash) -> Int
Returns the 32 bit signed integer digest of the hash.
Keep in mind that these values may return negative numbers!
Examples
hash_ints([1, 2, 3], 0)
|> int_digest
// -> -2133732860