Skip to content

moznion/metro-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MetroHash for Zig test

MetroHash library for Zig.

This library provides 64-bit and 128-bit MetroHash hashing functions.

Synopsis

64-bit Hash

var data = [_]u8{
    48, 49, 50, 51, 52, 53, 54, 55,
    56, 57, 48, 49, 50, 51, 52, 53,
    54, 55, 56, 57, 48, 49, 50, 51,
    52, 53, 54, 55, 56, 57, 48, 49,
    50, 51, 52, 53, 54, 55, 56, 57,
    48, 49, 50, 51, 52, 53, 54, 55,
    56, 57, 48, 49, 50, 51, 52, 53,
    54, 55, 56, 57, 48, 49, 50,
};
const seed: u64 = 1;
const hash: u64 = hash64(data[0..], seed);

128-bit Hash

var data = [_]u8{
    48, 49, 50, 51, 52, 53, 54, 55,
    56, 57, 48, 49, 50, 51, 52, 53,
    54, 55, 56, 57, 48, 49, 50, 51,
    52, 53, 54, 55, 56, 57, 48, 49,
    50, 51, 52, 53, 54, 55, 56, 57,
    48, 49, 50, 51, 52, 53, 54, 55,
    56, 57, 48, 49, 50, 51, 52, 53,
    54, 55, 56, 57, 48, 49, 50,
};
const seed: u64 = 1;
const hash: u128 = hash128(data[0..], seed);

How to build and test

$ git submodule init && git submodule update
$ zig build test

Note

This implementation is based on jandrewrogers/MetroHash and dgryski/go-metro.

License

MIT

Author

moznion (moznion@mail.moznion.net)

Releases

No releases published

Packages

No packages published

Languages