fnv v0.3.2 FNV.FNV1a

Fowler–Noll–Vo hash functions, variant 1a (FNV-1a)

Collection of functions to calculate a FNV-1 hash for different bit lengths.

Summary

Functions

Returns an integer hash of provided bit length. Input must be a binary/string

Shortcut for hash(data, 1024)

Shortcut for hash(data, 128)

Shortcut for hash(data, 256)

Shortcut for hash(data, 32)

Shortcut for hash(data, 512)

Shortcut for hash(data, 64)

Returns a hexadecimal hash of provided bit length. Input must be a binary/string

Shortcut for hex(data, 1024)

Shortcut for hex(data, 128)

Shortcut for hex(data, 256)

Shortcut for hex(data, 32)

Shortcut for hex(data, 512)

Shortcut for hex(data, 64)

Functions

calculate_hash(bits, prime, current_hash, arg)

Callback implementation for FNV.Algo.calculate_hash/4.

hash(data, bit_length)

Returns an integer hash of provided bit length. Input must be a binary/string.

Examples

FNV.FNV1.hash("fnv", 32)
#=> 1099915385

FNV.FNV1a.hash("fnv", 32)
#=> 3002452889
hash1024(data)

Shortcut for hash(data, 1024)

hash128(data)

Shortcut for hash(data, 128)

hash256(data)

Shortcut for hash(data, 256)

hash32(data)

Shortcut for hash(data, 32)

hash512(data)

Shortcut for hash(data, 512)

hash64(data)

Shortcut for hash(data, 64)

hex(data, bit_length)

Returns a hexadecimal hash of provided bit length. Input must be a binary/string.

Examples

FNV.FNV1.hex("fnv", 32)
#=> "418f6079"

FNV.FNV1a.hex("fnv", 32)
#=> "b2f5cb99"
hex1024(data)

Shortcut for hex(data, 1024)

hex128(data)

Shortcut for hex(data, 128)

hex256(data)

Shortcut for hex(data, 256)

hex32(data)

Shortcut for hex(data, 32)

hex512(data)

Shortcut for hex(data, 512)

hex64(data)

Shortcut for hex(data, 64)