Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

silviucpp/erl_hash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

erl_hash

Build Status GitHub License Hex.pm Version

Overview

erl_hash is an Erlang library providing a collection of high-performance hash algorithms not included in the standard Erlang libraries.
It is designed for both compatibility with existing systems and easy integration for new projects.

Supported Hash Algorithms

Murmur3 x64 128-bit

Function Description
murmur3_x64_128_legacy Returns the top 32 bits of the 128-bit hash. Compatible with VoltDB-style consistent hashing.
murmur3_x64_128_bin Returns the full 128-bit hash as a 16-byte binary buffer.
murmur3_x64_128_hex Returns the full 128-bit hash as a 32-character hexadecimal string.

Murmur2

  • murmur2 – standard 32-bit Murmur2 hash implementation.

FNV (Fowler–Noll–Vo)

Function Description
fnv1_32 FNV-1 32-bit hash
fnv1a_32 FNV-1a 32-bit hash
fnv1_64 FNV-1 64-bit hash
fnv1a_64 FNV-1a 64-bit hash

XXHash

Function Description
xxhash_32 32-bit XXHash
xxhash_64 64-bit XXHash
xxhash_128 128-bit XXHash (binary)
xxhash_128_hex 128-bit XXHash (32-character hexadecimal string)

Build

To compile the project, simply run:

rebar3 compile

Usage Example

erl_hash:murmur3_x64_128_legacy(<<"hello">>, 0).
-874993741

erl_hash:murmur3_x64_128_bin(<<"hello">>, 0).
<<203,216,167,179,65,189,155,2,91,30,144,106,72,174,29,25>>

erl_hash:murmur3_x64_128_hex(<<"hello">>, 0).
<<"cbd8a7b341bd9b025b1e906a48ae1d19">>

About

Erlang collection of different hash algorithms

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published